Minor improvements on error handling on frontend.

This commit is contained in:
Andrey Antukh 2021-01-22 15:23:21 +01:00 committed by Alonso Torres
parent 594bceff77
commit 4ee1f9cf2c
5 changed files with 20 additions and 18 deletions

View file

@ -101,7 +101,7 @@
(mf/defc on-main-error
[{:keys [error] :as props}]
(let [data (ex-data error)]
(ptk/handle-error error)
(mf/use-effect #(ptk/handle-error error))
[:span "Internal application errror"]))
(mf/defc main-page
@ -285,22 +285,17 @@
(ptk/handle-error (ex-data error))
(do
(ts/schedule
(st/emitf (dm/show
{:content "Something wrong has happened."
:type :error
:timeout 3000})))
(st/emitf (dm/assign-exception error)))
(js/console.group "Internal error:")
(js/console.log "hint:" (or (ex-message error)
(:hint error)
(:message error)))
(ex/ignoring
(js/console.error "repr: " (pr-str error))
(js/console.error "data: " (clj->js error))
(js/console.error (clj->js error))
(js/console.error "stack:" (.-stack error)))
(js/console.groupEnd "Internal error:"))))
(defonce uncaught-error-handler
(letfn [(on-error [event]
(ptk/handle-error (unchecked-get event "error"))