mirror of
https://github.com/penpot/penpot.git
synced 2025-06-16 09:51:38 +02:00
✨ Improve trace reporting on unhandled exception
This commit is contained in:
parent
3b61a7dd91
commit
7a8b0e710b
1 changed files with 9 additions and 2 deletions
|
@ -30,7 +30,14 @@
|
||||||
[error]
|
[error]
|
||||||
(cond
|
(cond
|
||||||
(instance? ExceptionInfo error)
|
(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)
|
(map? error)
|
||||||
(ptk/handle-error error)
|
(ptk/handle-error error)
|
||||||
|
@ -49,7 +56,7 @@
|
||||||
|
|
||||||
(defmethod ptk/handle-error :default
|
(defmethod ptk/handle-error :default
|
||||||
[error]
|
[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)))
|
(ts/schedule #(st/emit! (rt/assign-exception error)))
|
||||||
(js/console.group hint)
|
(js/console.group hint)
|
||||||
(ex/ignoring (js/console.error (pr-str error)))
|
(ex/ignoring (js/console.error (pr-str error)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue