Can you "plug in" to unhandled Promise rejections in Chrome? [duplicate]
Until window.addEventListener('unhandledrejection', e => ...)
is here you may hack your own Promise constructor which creates original Promise and calls catch
on it passing:
error => { var errorEvent = new ErrorEvent('error', { message: error.message, error: error }); window.dispatchEvent(errorEvent); // For error listeners. throw error; // I prefer to see errors on the console.}
But it seems we have to patch then
, catch
and Promise.reject
also -- lots of work.
Someone may want to write a polyfill to emit custom unhandledrejection
event in such cases.