Enhance global error handling
Reviewed By: lblasa Differential Revision: D44332732 fbshipit-source-id: d36b47e820906213cb829fb7d4d2f3b60ae08c71
This commit is contained in:
committed by
Facebook GitHub Bot
parent
77b7799493
commit
d67b073f20
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user