Permalink
Browse files

Add class names of exceptions.

  • Loading branch information...
1 parent c6d04e7 commit 82fca9c9a04a797ce7dda02cad68f8835f7f88ba @joegallo joegallo committed Nov 3, 2010
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/clj_stacktrace/repl.clj
@@ -52,6 +52,10 @@
(defn method-str [parsed]
(if (:java parsed) (java-method-str parsed) (clojure-method-str parsed)))
+(defn pst-class-on [on color? class]
+ (.append on (colored color? :red (str (.getName class) ": ")))
+ (.flush on))
+
(defn pst-message-on [on color? message]
(.append on (colored color? :red message))
(.append on "\n")
@@ -72,9 +76,16 @@
(.append on "\n")
(.flush on))))
+(defn pst-caused-by-on
+ [on color?]
+ (.append on (colored color? :red "Caused by: "))
+ (.flush on))
+
(defn- pst-cause-on
[on color? exec source-width]
- (pst-message-on on color? (str "Caused by: " (:message exec)))
+ (pst-caused-by-on on color?)
+ (pst-class-on on color? (:class exec))
+ (pst-message-on on color? (:message exec))
(pst-elems-on on color? (:trimmed-elems exec) source-width)
(if-let [cause (:cause exec)]
(pst-cause-on on color? cause source-width)))
@@ -96,6 +107,7 @@
ANSI colored if color? is true."
(let [exec (parse-exception e)
source-width (find-source-width exec)]
+ (pst-class-on on color? (:class exec))
(pst-message-on on color? (:message exec))
(pst-elems-on on color? (:trace-elems exec) source-width)
(if-let [cause (:cause exec)]

0 comments on commit 82fca9c

Please sign in to comment.