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 163
163
(defmethod print TaggedLiteral [x w]
164
164
(print-method x w))
165
165
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 " ]" ))
168
180
169
181
(defmethod print :default [^Object x, ^TruncatingStringWriter w]
170
182
(.write w (.toString x)))
Original file line number Diff line number Diff line change 87
87
" #Delay[<pending>]" (delay 1 )
88
88
" #Delay[1]" (doto (delay 1 ) deref)
89
89
" #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" ))
90
95
" #function[clojure.core/str]" str))
91
96
92
97
(deftest print-writer-limits
You can’t perform that action at this time.
0 commit comments