Raise the given error object, best if created by an error
constructor defined with deferror. See also 'raise' macro.
(defn raise*
"Raise the given error object, best if created by an error
constructor defined with deferror. See also 'raise' macro."
[err]
(let [err-tag (:tag err)]
(loop [hs *handler-stack*]
(if (empty? hs)
((:unhandled err) err)
(let [[{:keys [htag] :as handler}] hs]
(if (and htag (not (isa? err-tag htag)))
(recur (next hs))
(let [rtn ((:hfunc handler) err)]
(if-not (vector? rtn)
(throw-to "default" handler (list rtn))
(condp = (rtn 0)
::continue-with (rtn 1)
::continue (if-let [continue (*continues* (rtn 1))]
(throw-to "continue" continue (rtn 2))
(do (prn *continues*) (throw
(Exception.
(str "Unbound continue name " (rtn 1))))))
::do-not-handle (recur (next hs))
(throw-to "do-not-handle" handler (list rtn)))))))))))
Comments top
No comments for raise*. Log in to add a comment.