Prints a stack trace for a condition or Throwable. Skips frames for
classes in clojure.{core,lang,main} unless the *full-stack-traces* is
bound to logical true
(defn print-stack-trace
"Prints a stack trace for a condition or Throwable. Skips frames for
classes in clojure.{core,lang,main} unless the *full-stack-traces* is
bound to logical true"
[x]
(let [[header frames cause] (stack-trace-info x)]
(printf "%s\n" header)
(doseq [frame frames]
(let [classname (.getClassName frame)]
(if (or *full-stack-traces*
(not (re-matches
#"clojure.(?:core|lang|main).*" classname)))
(printf " at %s/%s(%s:%s)\n"
classname
(.getMethodName frame)
(.getFileName frame)
(.getLineNumber frame)))))
(when cause
(printf "caused by: ")
(recur cause))))
Comments top
No comments for print-stack-trace. Log in to add a comment.