Same catch
statement inside another catch
statement can be safely removed
try {
if (foo) {
try {
for await (const result of value) {
handleResponse(result);
}
setIsFetching(false);
setSubscription(null);
} catch (error) {
setIsFetching(false); // β duplicates can be safely removed
setResponse(formatError(error)); // β duplicates can be safely removed
setSubscription(null); // β duplicates can be safely removed
}
} else {
handleResponse(value);
}
} catch (error) {
setIsFetching(false);
setResponse(formatError(error));
setSubscription(null);
}
try {
if (foo) {
try {
for await (const result of value) {
handleResponse(result);
}
setIsFetching(false);
setSubscription(null);
} catch (error) {
setIsFetching(false);
setResponse(someAnotherFunction(error));
setSubscription(null);
}
} else {
handleResponse(value);
}
} catch (error) {
setIsFetching(false);
setResponse(formatError(error));
setSubscription(null);
}
real-world example graphql/graphiql#3033
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too