no-useless-catch
eslint
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"no-useless-catch": "error",
},
},
];try {
doSomethingThatMightThrow();
} catch (e) {
throw e;
}
try {
doSomethingThatMightThrow();
} catch (e) {
throw e;
} finally {
cleanUp();
}try {
doSomethingThatMightThrow();
} catch (e) {
doSomethingBeforeRethrow();
throw e;
}
try {
doSomethingThatMightThrow();
} catch (e) {
handleError(e);
}
try {
doSomethingThatMightThrow();
} finally {
cleanUp();
}Examples from the ESLint documentation.
no-useless-catch
eslint
export default [
{
rules: {
"no-useless-catch": "error",
},
},
];no-useless-catch
eslint plugin · correctness
{
"rules": {
"no-useless-catch": "error"
}
}complexity/noUselessCatch
complexity · since 1.0.0
{
"linter": {
"rules": {
"complexity": {
"noUselessCatch": "error"
}
}
}
}Disallow control flow statements in finally blocks
Require generator functions to contain yield
Disallow characters which are made with multiple code points in character class syntax
Disallow comparing against -0