New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RethrowCaughtException should not be triggered when there is more general exception below #4367
Labels
Comments
You are right. Do you want to give it a try and send a PR solving it? |
@BraisGabin I would like to give it a try |
Go for it! Let me know if you need any help :) |
strkkk
added a commit
to strkkk/detekt
that referenced
this issue
Dec 10, 2021
strkkk
added a commit
to strkkk/detekt
that referenced
this issue
Dec 11, 2021
strkkk
added a commit
to strkkk/detekt
that referenced
this issue
Dec 18, 2021
strkkk
added a commit
to strkkk/detekt
that referenced
this issue
Dec 21, 2021
strkkk
added a commit
to strkkk/detekt
that referenced
this issue
Dec 21, 2021
BraisGabin
pushed a commit
that referenced
this issue
Dec 21, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected Behavior of the rule
Following code should be compliant with RethrowCaughtException rule:
Context
In above case I want to log all exceptions except for the Cancellation exception (which I just want to propagate). That's why CancellationException has its own catch that gets activated before the general one, which is then never reached. This cause clause is not useless because it is used to filter more general cause clauses that come after it.
Above snippet is just a more cleaner way to write following code, which is compliant:
The text was updated successfully, but these errors were encountered: