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 = () => {
|
export const startGlobalErrorHandling = () => {
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
window.onerror = (event) => {
|
window.onerror = (
|
||||||
console.error('"onerror" event intercepted:', event);
|
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) => {
|
window.onunhandledrejection = (event) => {
|
||||||
console.error('"unhandledrejection" event intercepted:', event.reason);
|
console.error('"unhandledrejection" event intercepted:', event.reason);
|
||||||
|
|||||||
Reference in New Issue
Block a user