Clojure (JVM) will throw a Java exception object when an exception occurs. Clojure converts this to data using the Throwable->map function, and then prints it for you. You can call this function yourself:
user=> (try (throw (Exception. "BOOM!")) (catch Exception e (Throwable->map e))) {:cause "BOOM!", :via [{:type java.lang.Exception, :message "BOOM!", :at [user$eval1 invokeStatic "NO_SOURCE_FILE" 1]}], :trace [[user$eval1 invokeStatic "NO_SOURCE_FILE" 1] ...]}
Then you can simply use regular keyword accessories for the returned data:
user=> (println (:cause *1) (first (:via *1))) BOOM! {:type java.lang.Exception, :message BOOM!, :at [user$eval7 invokeStatic NO_SOURCE_FILE 4]}
source share