From d67b073f20026327fa410bec8229f828639ada49 Mon Sep 17 00:00:00 2001 From: Andrey Goncharov Date: Thu, 23 Mar 2023 07:08:22 -0700 Subject: [PATCH] Enhance global error handling Reviewed By: lblasa Differential Revision: D44332732 fbshipit-source-id: d36b47e820906213cb829fb7d4d2f3b60ae08c71 --- .../src/utils/globalErrorHandling.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/desktop/flipper-ui-core/src/utils/globalErrorHandling.tsx b/desktop/flipper-ui-core/src/utils/globalErrorHandling.tsx index d6336754c..4d5eb6f3b 100644 --- a/desktop/flipper-ui-core/src/utils/globalErrorHandling.tsx +++ b/desktop/flipper-ui-core/src/utils/globalErrorHandling.tsx @@ -9,8 +9,20 @@ export const startGlobalErrorHandling = () => { if (typeof window !== 'undefined') { - window.onerror = (event) => { - console.error('"onerror" event intercepted:', event); + window.onerror = ( + event: Event | string, + source?: string, + lineno?: number, + colno?: number, + error?: Error, + ) => { + console.error('"onerror" event intercepted:', event, { + source, + lineno, + colno, + error, + stack: (error as any)?.stack, + }); }; window.onunhandledrejection = (event) => { console.error('"unhandledrejection" event intercepted:', event.reason);