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:
parent
3b61a7dd91
commit
7a8b0e710b
1 changed files with 9 additions and 2 deletions
|
@ -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)))
|
||||
|
|
Loading…
Add table
Reference in a new issue