grantmakers / profiles

Grantmakers.io Profiles - Summary profiles for all US-based foundations who have filed electronic IRS Form 990-PF
MIT License
1 stars 1 forks source link

Resolve errors caused by Facebook's fbclid parameter #78

Closed chadokruse closed 5 years ago

chadokruse commented 5 years ago

Docs: https://docs.bugsnag.com/platforms/javascript/configuration-options/

To force issue for local testing purposes:

// TypeError: Illegal invocation
const q = document.querySelectorAll;
q('body');
chadokruse commented 5 years ago

To silence BugSnag TypeError: Illegal Invocation errors caused by fbclid parameter:

const bugsnagClient = bugsnag({
  apiKey: <key>, // Notify Key - is public
  appVersion: <version>,
  beforeSend: function(report) {
    const params = new URLSearchParams(location.search);
    const fbclidCheck = params.get('fbclid');
    if (fbclidCheck && report.errorClass === 'TypeError' && report.errorMessage === 'Illegal invocation') {
      report.ignore();
    }
  },
});