From 2052af9c20774adca639bdaae8d065d5b01d03a8 Mon Sep 17 00:00:00 2001 From: JayaKrishnaNamburu Date: Thu, 23 Jun 2022 15:06:58 +0530 Subject: [PATCH] Handle browser support errors, where error obj is missing --- panic-overlay.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/panic-overlay.js b/panic-overlay.js index f3ed599..cdcb0f0 100644 --- a/panic-overlay.js +++ b/panic-overlay.js @@ -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) {