АГ
(defmacro try-catchall
"See prismatic schema.macros/try-catchall."
[& body]
(let [[try-body
[catch bind & catch-body]
[finally & fin]] (if (= 'catch (first (last body)))
(cons (butlast body)
(take-last 1 body))
(cons (butlast (butlast body))
(take-last 2 body)))]
(assert (= catch 'catch))
(assert (symbol? bind))
(assert (contains? #{'finally nil} finally))
;; finally in core.async can break your code: https://dev.clojure.org/jira/browse/ASYNC-198
(if-not finally
`(if-cljs
(try ~@try-body (catch js/Error ~bind ~@catch-body))
(try ~@try-body (catch Throwable ~bind ~@catch-body)))
`(if-cljs
(try ~@try-body (catch js/Error ~bind ~@catch-body) (finally ~@fin))
(try ~@try-body (catch Throwable ~bind ~@catch-body) (finally ~@fin))))))