MCPcopy Index your code
hub / github.com/ampproject/amphtml / installErrorReporting

Function installErrorReporting

src/error-reporting.js:296–310  ·  view source on GitHub ↗
(win)

Source from the content-addressed store, hash-verified

294 * @param {!Window} win
295 */
296export function installErrorReporting(win) {
297 win.onerror = /** @type {!Function} */ (onError);
298 win.addEventListener('unhandledrejection', (event) => {
299 if (
300 event.reason &&
301 (event.reason.message === CANCELLED ||
302 event.reason.message === BLOCK_BY_CONSENT ||
303 event.reason.message === ABORTED)
304 ) {
305 event.preventDefault();
306 return;
307 }
308 reportError(event.reason || new Error('rejected promise ' + event));
309 });
310}
311
312/**
313 * Signature designed, so it can work with window.onerror

Callers 3

amp.jsFile · 0.90
amp-inabox.jsFile · 0.90

Calls 2

reportErrorFunction · 0.85
addEventListenerMethod · 0.45

Tested by

no test coverage detected