Added basic exception handler.
This commit is contained in:
parent
63d9301a27
commit
614a2d89cb
|
@ -47,7 +47,8 @@
|
|||
[status-im.components.status :as status]
|
||||
[status-im.components.styles :as st]
|
||||
[status-im.chat.styles.screen :as chat-st]
|
||||
[status-im.profile.qr-code.screen :refer [qr-code-view]]))
|
||||
[status-im.profile.qr-code.screen :refer [qr-code-view]]
|
||||
[status-im.utils.utils :as utils]))
|
||||
|
||||
(defn init-back-button-handler! []
|
||||
(let [new-listener (fn []
|
||||
|
@ -166,6 +167,7 @@
|
|||
[component])]])]]))))})))
|
||||
|
||||
(defn init []
|
||||
(utils/register-exception-handler)
|
||||
(status/call-module status/init-jail)
|
||||
(dispatch-sync [:reset-app])
|
||||
(.registerComponent app-registry "StatusIm" #(r/reactify-component app-root))
|
||||
|
|
|
@ -43,7 +43,8 @@
|
|||
[taoensso.timbre :as log]
|
||||
[status-im.chat.styles.screen :as st]
|
||||
[status-im.profile.qr-code.screen :refer [qr-code-view]]
|
||||
[status-im.components.status :as status]))
|
||||
[status-im.components.status :as status]
|
||||
[status-im.utils.utils :as utils]))
|
||||
|
||||
(defn orientation->keyword [o]
|
||||
(keyword (.toLowerCase o)))
|
||||
|
@ -137,6 +138,7 @@
|
|||
[component])]])]))))})))
|
||||
|
||||
(defn init []
|
||||
(utils/register-exception-handler)
|
||||
(status/call-module status/init-jail)
|
||||
(dispatch-sync [:reset-app])
|
||||
(dispatch [:listen-to-network-status!])
|
||||
|
|
|
@ -116,3 +116,16 @@
|
|||
(apply update m k f args)
|
||||
m))
|
||||
|
||||
(defn default-alert-handler
|
||||
[error fatal?]
|
||||
(show-popup "Error" (.-message error)))
|
||||
|
||||
(defn register-exception-handler
|
||||
"Register a function that will be called for each exception thrown.
|
||||
When `dev?` is true, always register; otherwise only register when goog.DEBUG is false.
|
||||
Default function shows error details in an alert box."
|
||||
([] (register-exception-handler default-alert-handler))
|
||||
([f] (register-exception-handler true f))
|
||||
([dev? f]
|
||||
(if (or dev? (not js/goog.DEBUG))
|
||||
(.setGlobalHandler js/ErrorUtils f dev?))))
|
||||
|
|
Loading…
Reference in New Issue