Skip to content

Commit

Permalink
Handle browser support errors, where error obj is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
JayaKrishnaNamburu committed Jun 23, 2022
1 parent cbebfbd commit 2052af9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion panic-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,13 @@ function toggle (yes) {

function onUncaughtError (e) { if (config.handleErrors) panic (e) }

window.addEventListener ('error', e => onUncaughtError (e.error))
window.addEventListener ('error', e => {
if (!e.error) {
onUncaughtError (e.message)
return
}
onUncaughtError (e.error)
})
window.addEventListener ('unhandledrejection', e => onUncaughtError (e.reason))

;(function onReady (fn) {
Expand Down

0 comments on commit 2052af9

Please sign in to comment.