mirror of
https://github.com/penpot/penpot.git
synced 2026-08-05 12:29:00 +00:00
✨ Add helper for proper print js exceptions
This commit is contained in:
parent
2523096fdd
commit
bd2ef8057e
@ -241,7 +241,20 @@
|
|||||||
(with-out-str
|
(with-out-str
|
||||||
(print-all cause)))))
|
(print-all cause)))))
|
||||||
|
|
||||||
#?(:clj
|
(defn print-throwable
|
||||||
(defn print-throwable
|
[cause & {:as opts}]
|
||||||
[cause & {:as opts}]
|
#?(:clj
|
||||||
(println (format-throwable cause opts))))
|
(println (format-throwable cause opts))
|
||||||
|
:cljs
|
||||||
|
(let [prefix (get opts :prefix "exception")
|
||||||
|
title (str prefix ": " (ex-message cause))
|
||||||
|
exdata (ex-data cause)]
|
||||||
|
(js/console.group title)
|
||||||
|
(when-let [explain (get exdata ::sm/explain)]
|
||||||
|
(println (sm/humanize-explain explain)))
|
||||||
|
|
||||||
|
(js/console.log "\nData:")
|
||||||
|
(pp/pprint (dissoc exdata ::sm/explain))
|
||||||
|
|
||||||
|
(js/console.log "\nTrace:")
|
||||||
|
(js/console.error (.-stack cause)))))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user