-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Rule proposal: no-identical-catch
#2046
Labels
Comments
What if function setResponse(error) {
if (error instanceof FooError) {
throw new BarError()
}
if (error instanceof BarError) {
// ...
}
} |
@fisker possible but very rare case, a perfect case for eslint-disable comment |
I'd say this example is also rare case ... Anyway, if this get accepted, as a reminder, should be carefully when there are flow control statements, including |
Another possible rule proposal in this code. try {
+ try {
// ...
+ } finally {
setIsFetching(false);
+ }
- setSubscription(null);
} catch (error) {
- setIsFetching(false);
setResponse(someAnotherFunction(error));
- setSubscription(null);
}
+ finally {
+ setSubscription(null);
+ } (typing on cellphone, maybe bad indentation) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Same
catch
statement inside anothercatch
statement can be safely removedFail
Pass
Additional Info
real-world example graphql/graphiql#3033
The text was updated successfully, but these errors were encountered: