Don't auto-capture handled errors (React Native)


I’m using the React Native SDK in my app. I noticed that many of the events that are captured have been handled by my app and I would like to avoid having these events sent to Sentry to save my quota and focus on what I think is important.

In some cases I catch and handle the error in some way and in other cases I specifically call Sentry.captureException.

A short example:

try {
  return await fetchSomeData(); // throws an error which is instanceof Error
} catch (error) {
  if (error.status === 401) {
    refreshLoginToken(); // I know how to handle the error and go about my day
    return; // Exit, I don't want this to show up in Sentry at all
  Sentry.captureException(error); // I don't know what happened here, I want this to show up in Sentry

Based on my description and my short example, is there a way to achieve the effect I’m after?

hey, you could filter events based on your own conditions.