Only use unhandledrejection fallback when needed
This commit is contained in:
parent
36653517a5
commit
999b5da753
|
@ -1172,6 +1172,7 @@ if (typeof document != 'undefined' && document.getElementsByTagName) {
|
|||
function handleError(err) {
|
||||
// dispatch an error event so that we can display in errors in browsers
|
||||
// that don't yet support unhandledrejection
|
||||
if (window.onunhandledrejection === undefined) {
|
||||
try {
|
||||
var evt = new Event('error');
|
||||
} catch (_eventError) {
|
||||
|
@ -1181,6 +1182,7 @@ if (typeof document != 'undefined' && document.getElementsByTagName) {
|
|||
evt.message = err.message;
|
||||
evt.error = err;
|
||||
window.dispatchEvent(evt);
|
||||
}
|
||||
|
||||
// throw so it still shows up in the console
|
||||
throw err;
|
||||
|
|
|
@ -12,6 +12,7 @@ if (typeof document != 'undefined' && document.getElementsByTagName) {
|
|||
function handleError(err) {
|
||||
// dispatch an error event so that we can display in errors in browsers
|
||||
// that don't yet support unhandledrejection
|
||||
if (window.onunhandledrejection === undefined) {
|
||||
try {
|
||||
var evt = new Event('error');
|
||||
} catch (_eventError) {
|
||||
|
@ -21,6 +22,7 @@ if (typeof document != 'undefined' && document.getElementsByTagName) {
|
|||
evt.message = err.message;
|
||||
evt.error = err;
|
||||
window.dispatchEvent(evt);
|
||||
}
|
||||
|
||||
// throw so it still shows up in the console
|
||||
throw err;
|
||||
|
|
Loading…
Reference in New Issue