print-throwable

added
1.1

ns
clojure.stacktrace

type
function

(print-throwable tr)

Prints the class and message of a Throwable.

                ;; let's make an exception
(def anex (try (/ 1 0) (catch Exception ex ex)))

;; now print the exception
(clojure.stacktrace/print-throwable anex)
;; java.lang.ArithmeticException: Divide by zero
;=> nil

;; and catch it in a string
(def msg (with-out-str (clojure.stacktrace/print-throwable anex)))
;=> #'boot.user/msg

msg
;=> "java.lang.ArithmeticException: Divide by zero"