diff --git a/compiler+runtime/src/jank/clojure/core.jank b/compiler+runtime/src/jank/clojure/core.jank index e2ed9d5b5..59366c3fe 100644 --- a/compiler+runtime/src/jank/clojure/core.jank +++ b/compiler+runtime/src/jank/clojure/core.jank @@ -32,10 +32,29 @@ (def ex-info "Create an instance of ExceptionInfo, a RuntimeException subclass that carries a map of additional data." - ; TODO: Arity 3 - (fn* ex-info [msg map] - {:error msg - :data map})) + (fn* ex-info + ([msg map] + {:error msg + :data map}) + ([msg map cause] + {:error msg + :data map + :cause cause}))) + +(def ex-message + "Returns the message attached to ex if ex is a Throwable. + Otherwise returns nil." + :error) + +(def ex-data + "Returns exception data (a map) if ex is an IExceptionInfo. + Otherwise returns nil." + :data) + +(def ex-cause + "Returns the cause of ex if ex is a Throwable. + Otherwise returns nil." + :cause) ; Relations. ;; Miscellaneous. @@ -5698,30 +5717,6 @@ ;; (drop-while #(= class-name (.getClassName ^StackTraceElement %1)) tr)))))) (throw "TODO: port")) -(defn ex-data - "Returns exception data (a map) if ex is an IExceptionInfo. - Otherwise returns nil." - [ex] - ;; (when (instance? IExceptionInfo ex) - ;; (.getData ^IExceptionInfo ex)) - (throw "TODO: port")) - -(defn ex-message - "Returns the message attached to ex if ex is a Throwable. - Otherwise returns nil." - [ex] - ;; (when (instance? Throwable ex) - ;; (.getMessage Throwable ex)) - (throw "TODO: port")) - -(defn ex-cause - "Returns the cause of ex if ex is a Throwable. - Otherwise returns nil." - [ex] - ;; (when (instance? Throwable ex) - ;; (.getCause ^Throwable ex)) - (throw "TODO: port")) - (defn test "test [v] finds fn at key :test in var metadata and calls it, presuming failure will throw exception"