You're viewing version 1.2.0 of print-stack-trace. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

print-stack-trace

clojure.stacktrace

  • (print-stack-trace tr)
  • (print-stack-trace tr n)
Prints a Clojure-oriented stack trace of tr, a Throwable.
Prints a maximum of n stack frames (default: unlimited).
Does not print chained exceptions (causes).

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/stacktrace.clj:44 top

(defn print-stack-trace
  "Prints a Clojure-oriented stack trace of tr, a Throwable.
  Prints a maximum of n stack frames (default: unlimited).
  Does not print chained exceptions (causes)."
  {:added "1.1"}
  ([tr] (print-stack-trace tr nil))
  ([tr n]
     (let [st (.getStackTrace tr)]
       (print-throwable tr)
       (newline)
       (print " at ") 
       (print-trace-element (first st))
       (newline)
       (doseq [e (if (nil? n)
		   (rest st)
		   (take (dec n) (rest st)))]
	 (print "    ")
	 (print-trace-element e)
	 (newline)))))
Vars in clojure.stacktrace/print-stack-trace: defn doseq first let newline print
Used in 0 other vars

Comments top

No comments for print-stack-trace. Log in to add a comment.