src/worker-error-reporting.js
/**
   * Report error to AMP's error reporting frontend.
   *
   * @param {*} e
   */
Report error to AMP's error reporting frontend.
Report error to AMP ' s error reporting frontend .
function report(e) {
    if (urls.localhostRegex.test(self.location.origin)) {
      return;
    }
    if (!(e instanceof Error)) {
      e = new Error(e);
    }
    const config = self.AMP_CONFIG || {};
    const url = urls.errorReporting + '?' +
        `${tag}=1` + 
        '&v=' + encodeURIComponent(config.v) +
        '&m=' + encodeURIComponent(e.message) +
        '&ca=' + (config.canary ? 1 : 0) +
        '&s=' + encodeURIComponent(e.stack || '');
    fetch(url,  ({
      mode: 'no-cors',
    })).catch(reason => {
      console.error(reason);
    });
  }
function report ( e ) { if ( urls . localhostRegex . test ( self . location . origin ) ) { return ; } if ( ! ( e instanceof Error ) ) { e = new Error ( e ) ; } const config = self . AMP_CONFIG || { } ; const url = urls . errorReporting + '?' + ` ${ tag } ` + '&v=' + encodeURIComponent ( config . v ) + '&m=' + encodeURIComponent ( e . message ) + '&ca=' + ( config . canary ? 1 : 0 ) + '&s=' + encodeURIComponent ( e . stack || '' ) ; fetch ( url , ( { mode : 'no-cors' , } ) ) . catch ( reason => { console . error ( reason ) ; } ) ; }
Report error to AMP's error reporting frontend.
Report error to AMP ' s error reporting frontend .
// Don't report local dev errors. // Tags request as coming from a worker. /** @type {!RequestInit} */ // We don't care about the response. /*OK*/