Mute General Javascript Exceptions, but keep handy integrations

Hi,
I am embedding sentry client side via javascript. I only want to throw an exception when this one thing goes wrong. This means I don’t want sentry to alert me every-time something goes wrong in the client side JS. I am throwing my exception to sentry on failure, but how do I mute all other fired events?
I saw it was recommended to set

Sentry.init({
    defaultIntegrations: false
)}

But then I lose other info like breadcrumbs, os type, etc… Just useful data in general.

Will turning off the GlobalHandler integration work?

  Sentry.init({
    // Turn off general error handling
    integrations: [
      new Sentry.Integrations.GlobalHandlers({
        onerror: false,
        onunhandledrejection: false,
      })
    ]
  });

Will this stop notifying me every-time something on the client side breaks and only send me notifications when I call:

Sentry.captureException()

Exactly, if you only disable the GlobalHandlers integration only calls Sentry.captureException() will send errors to Sentry.

1 Like

Awesome thanks for confirming! I appreciate the fast response! :grinning: