0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-26 06:31:26 -05:00

Improve trace reporting on unhandled exception

This commit is contained in:
Andrey Antukh 2022-12-31 10:49:04 +01:00
parent 3b61a7dd91
commit 7a8b0e710b

View file

@ -30,7 +30,14 @@
[error]
(cond
(instance? ExceptionInfo error)
(-> error ex-data ptk/handle-error)
(let [data (ex-data error)]
(if (contains? data :type)
(ptk/handle-error data)
(let [hint (str/ffmt "Unexpected error: '%'" (ex-message error))]
(ts/schedule #(st/emit! (rt/assign-exception error)))
(js/console.group hint)
(js/console.log (.-stack error))
(js/console.groupEnd hint))))
(map? error)
(ptk/handle-error error)
@ -49,7 +56,7 @@
(defmethod ptk/handle-error :default
[error]
(let [hint (str/concat "Unexpected error: " (:hint error))]
(let [hint (str/ffmt "Unhandled error: '%'" (:hint error "[no hint]"))]
(ts/schedule #(st/emit! (rt/assign-exception error)))
(js/console.group hint)
(ex/ignoring (js/console.error (pr-str error)))