;; *** before: ***
;; a typo deep in a macro produced a raw stack trace with no
;; indication of which phase - reading, macroexpansion, or
;; execution - actually failed
(defn broke [] (+ 1 "two"))
(broke)
;; ClassCastException java.lang.String cannot be cast to
;; java.lang.Number clojure.lang.Numbers.add (Numbers.java:...)
;; *** in version 1.10: ***
;; the REPL now names the phase and the failing form up front
(broke)
;; Execution error (ClassCastException) at user/broke (REPL:1).
;; class java.lang.String cannot be cast to class java.lang.Number
;; the same data is available to tooling via ex-triage
(require '[clojure.main :as main])
(-> (try (broke) (catch Throwable t t))
Throwable->map
main/ex-triage
:clojure.error/phase)
;=> :execution