File tree Expand file tree Collapse file tree 1 file changed +28
-3
lines changed Expand file tree Collapse file tree 1 file changed +28
-3
lines changed Original file line number Diff line number Diff line change 413413(defmethod print-method StackTraceElement [^StackTraceElement o ^Writer w]
414414 (print-method [(symbol (.getClassName o)) (symbol (.getMethodName o)) (.getFileName o) (.getLineNumber o)] w))
415415
416- (defn- throwable-as- map [^Throwable o]
416+ (defn Throwable-> map [^Throwable o]
417417 (let [base (fn [^Throwable t]
418418 {:type (class t)
419419 :message (.getLocalizedMessage t)
427427 :trace (vec (.getStackTrace (or ^Throwable (last via) o)))}))
428428
429429(defn- print-throwable [^Throwable o ^Writer w]
430- (.write w " #error" )
431- (print-method (throwable-as-map o) w))
430+ (.write w " #error {\n :cause " )
431+ (let [{:keys [cause via trace]} (Throwable->map o)
432+ print-via #(do (.write w " {:type " )
433+ (print-method (:type %) w)
434+ (.write w " \n :message " )
435+ (print-method (:message %) w)
436+ (.write w " \n :at " )
437+ (print-method (:at %) w)
438+ (.write w " }" ))]
439+ (print-method cause w)
440+ (when via
441+ (.write w " \n :via\n [" )
442+ (when-let [fv (first via)]
443+ (print-via fv)
444+ (doseq [v (rest via)]
445+ (.write w " \n " )
446+ (print-via v)))
447+ (.write w " ]" ))
448+ (when trace
449+ (.write w " \n :trace\n [" )
450+ (when-let [ft (first trace)]
451+ (print-method ft w)
452+ (doseq [t (rest trace)]
453+ (.write w " \n " )
454+ (print-method t w)))
455+ (.write w " ]" )))
456+ (.write w " }" ))
432457
433458(defmethod print-method Throwable [^Throwable o ^Writer w]
434459 (print-throwable o w))
You can’t perform that action at this time.
0 commit comments