Correctly log uncaught errors/unhandled promises (#3857)

This commit is contained in:
David Marby
2021-07-28 20:57:52 +02:00
committed by GitHub
parent a12ccc3faf
commit cecd95f0d7

View File

@@ -68,11 +68,11 @@ window['styled-components'] = styledComponents;
// Catch uncaught errors and report them
if (window && !isDevelopment()) {
window.addEventListener('error', e => {
console.error('Uncaught Error', e);
console.error('Uncaught Error', e.error || e);
trackEvent('Error', 'Uncaught Error');
});
window.addEventListener('unhandledrejection', e => {
console.error('Unhandled Promise', e);
console.error('Unhandled Promise', e.reason);
trackEvent('Error', 'Uncaught Promise');
});
}