sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Ignoring an Exception class does not ignore its children

Open adinauer opened this issue 2 years ago • 1 comments

Problem Statement

In .NET ignoring an Exception also ignores all of the Exceptions child classes. In Java only the class explicitly added to the list of ignored exceptions will be ignored.

Solution Brainstorm

We could align with .NET and also ignore subclasses.

adinauer avatar May 03 '22 14:05 adinauer

Also see https://github.com/getsentry/sentry-java/issues/1532, https://github.com/getsentry/sentry-java/pull/2014 and https://github.com/getsentry/sentry-docs/pull/4995

adinauer avatar May 03 '22 14:05 adinauer

hi @adinauer I have raised a PR to fix this, please review it and let me know if anything should be changed 🙂 Thanks

usrivastava92 avatar Oct 26 '23 07:10 usrivastava92

Thanks for the PR, I replied there. We'll discuss internally how to treat this breaking change.

adinauer avatar Oct 30 '23 08:10 adinauer

We are going to keep the current behaviour for SDK version 7. @adinauer Is there a more useful use case for the backend? In that case we could reconsider it.

stefanosiano avatar Nov 15 '23 15:11 stefanosiano

We are going to keep the current behaviour for SDK version 7. More on this:

  1. We allow to ignore an exception type with the current approach, and if the user wants to also ignore the children they can either add the children in the ignored list or use the beforeSend callback. If we change the option to also ignore children exceptions, if the users want to ignore only the parent they would need to use beforeSend
  2. If the current behaviour is unexpected, it's easily identifiable (the user would see the children exceptions in the Sentry dashboard). If we change the behaviour and the user expects only the parent to be ignored, that would be harder to realize, as the user would have no errors in the dashboard.

stefanosiano avatar Nov 16 '23 08:11 stefanosiano

@stefanosiano I guess there's nothing special about backends here. Just the usual exception handling. I personally would expect the feature to behave similar to how try/catch behaves which also applies to child classes but if you feel like there's too much of a risk we can keep existing behaviour for now and revisit on the next major.

adinauer avatar Nov 16 '23 10:11 adinauer

let's close this issue for the moment. In case we want to change the behaviour in the next major we will reopen it.

stefanosiano avatar Nov 22 '23 15:11 stefanosiano