File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
src/implant/dirac/implant Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 33 [chromex.logging :refer-macros [log warn error group group-end]]
44 [dirac.utils :as utils]))
55
6- ; -- handling exceptions ------- ---------------------------------------------------------------------------------------------
6+ ; -- handling global exceptions ---------------------------------------------------------------------------------------------
77
88(defn devtools-exception-handler! [_message _source _lineno _colno e]
99 (let [text (str " Internal Dirac Error: DevTools code has thrown an unhandled exception\n " (utils/format-error e))]
1313(defn register-global-exception-handler! []
1414 (oset js/window [" onerror" ] devtools-exception-handler!))
1515
16+ ; -- handling unhandled rejections in promises ------------------------------------------------------------------------------
17+
18+ (defn devtools-unhandled-rejection-handler! [event]
19+ (let [reason (oget event " reason" )
20+ text (str " Internal Dirac Error: DevTools code has thrown an unhandled rejection (in promise)\n "
21+ (utils/format-error reason))]
22+ (ocall (oget js/window " dirac" ) " addConsoleMessageToMainTarget" " error" text)))
23+
24+ (defn register-unhandled-rejection-handler! []
25+ (.addEventListener js/window " unhandledrejection" devtools-unhandled-rejection-handler!))
26+
27+ ; -- installation -----------------------------------------------------------------------------------------------------------
28+
1629(defn install! []
17- (register-global-exception-handler! ))
30+ (register-global-exception-handler! )
31+ (register-unhandled-rejection-handler! ))
You can’t perform that action at this time.
0 commit comments