sentry-java
sentry-java copied to clipboard
Ignoring an Exception class does not ignore its children
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.
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
hi @adinauer I have raised a PR to fix this, please review it and let me know if anything should be changed 🙂 Thanks
Thanks for the PR, I replied there. We'll discuss internally how to treat this breaking change.
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.
We are going to keep the current behaviour for SDK version 7. More on this:
- 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 usebeforeSend
- 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 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.
let's close this issue for the moment. In case we want to change the behaviour in the next major we will reopen it.