From 5e43b0c654ed5fa6d37c73beaf106169b20d46ef Mon Sep 17 00:00:00 2001 From: Andrew McCloud Date: Thu, 16 Mar 2023 09:01:53 -0700 Subject: [PATCH 1/2] Fix undefined error --- methods/flex-micro.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/methods/flex-micro.js b/methods/flex-micro.js index 6db11aa..fa9a918 100644 --- a/methods/flex-micro.js +++ b/methods/flex-micro.js @@ -56,6 +56,8 @@ window.SENTRY_INIT_METHODS["flex-micro"] = { // this disables temp queueing hanlders, must be done before calling window.onerror() delete window.__SENTRY_MICRO__.error_queue; for (const [type, args] of errors) { + let [micro, error] = match_and_extract(...args); + try { delete error.__sentry_captured__; // see temp_queueing_patch() } catch (x) {} From 88d9ebb28c06505a5a34946ede57e45f5f32ac25 Mon Sep 17 00:00:00 2001 From: Andrew McCloud Date: Fri, 17 Mar 2023 12:35:10 -0700 Subject: [PATCH 2/2] Add condition back --- methods/flex-micro.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/methods/flex-micro.js b/methods/flex-micro.js index fa9a918..f18f5b3 100644 --- a/methods/flex-micro.js +++ b/methods/flex-micro.js @@ -58,16 +58,18 @@ window.SENTRY_INIT_METHODS["flex-micro"] = { for (const [type, args] of errors) { let [micro, error] = match_and_extract(...args); - try { - delete error.__sentry_captured__; // see temp_queueing_patch() - } catch (x) {} - - if (type === 'error') { - window.onerror.apply(window, args); - } else if (type === 'unhandledrejection') { - window.onunhandledrejection.apply(window, args); - } else { // type === 'trycatch' - throw error; + if (micro) { + try { + delete error.__sentry_captured__; // see temp_queueing_patch() + } catch (x) {} + + if (type === 'error') { + window.onerror.apply(window, args); + } else if (type === 'unhandledrejection') { + window.onunhandledrejection.apply(window, args); + } else { // type === 'trycatch' + throw error; + } } } }