Skip to content

Commit

Permalink
Add class names of exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
joegallo committed Nov 3, 2010
1 parent c6d04e7 commit 82fca9c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/clj_stacktrace/repl.clj
Expand Up @@ -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")
Expand All @@ -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)))
Expand All @@ -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)]
Expand Down

0 comments on commit 82fca9c

Please sign in to comment.