File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 163163(defmethod print TaggedLiteral [x w]
164164 (print-method x w))
165165
166- (defmethod print Throwable [x w]
167- (print-method x w))
166+ (defmethod print Throwable [^Throwable x, ^TruncatingStringWriter w]
167+ (.write w " #Error[" )
168+ (.write w (str (.getName (class x)) " " ))
169+ (loop [cause x, msg nil ]
170+ (if cause
171+ (recur (.getCause cause) (str msg (when msg " : " ) (.getMessage cause)))
172+ (print msg w)))
173+ (when-let [data (not-empty (ex-data x))]
174+ (.write w " " )
175+ (print data w))
176+ (when-let [first-frame (first (.getStackTrace x))]
177+ (.write w " " )
178+ (print (str first-frame) w))
179+ (.write w " ]" ))
168180
169181(defmethod print :default [^Object x, ^TruncatingStringWriter w]
170182 (.write w (.toString x)))
Original file line number Diff line number Diff line change 8787 " #Delay[<pending>]" (delay 1 )
8888 " #Delay[1]" (doto (delay 1 ) deref)
8989 " #Delay[<failed>]" (let [d (delay (/ 1 0 ))] (try @d (catch Exception _)) d)
90+ #"#Error\[ clojure.lang.ExceptionInfo \" Boom\" \" orchard.print_test.+\"\] " (ex-info " Boom" {})
91+ #"#Error\[ clojure.lang.ExceptionInfo \" Boom\" \{ :a 1\} \" orchard.print_test.+\"\] " (ex-info " Boom" {:a 1 })
92+ #"#Error\[ java.lang.RuntimeException \" Runtime!\" \" orchard.print_test.+\"\] " (RuntimeException. " Runtime!" )
93+ #"#Error\[ java.lang.RuntimeException \" Outer: Inner\" \" orchard.print_test.+\"\] " (RuntimeException. " Outer"
94+ (RuntimeException. " Inner" ))
9095 " #function[clojure.core/str]" str))
9196
9297(deftest print-writer-limits
You can’t perform that action at this time.
0 commit comments