Skip to content

no-useless-catch

Reports a catch clause whose only statement is throw of the caught error, as in catch (e) { throw e; }. It is also reported when the try has a finally. A catch that does more, or that throws something else, is not reported.

A catch that only rethrows has the same effect as no catch: the error goes on up with its stack, so the clause is noise that makes a reader look for handling that is not there.

To fix, delete the catch (keep the finally, if there is one) or handle the error there.

Reported
...
try { f(); } catch (e) { throw e; }
try { f(); } catch (e) { throw e; } finally { g(); }
try { f(); } catch (e) { throw g; }
switch (a) {}
function f() {}
...
js:
lint:
rules:
no-useless-catch: warn # off (default), warn, error

Enabled by the presets: js/eslint-recommended, js/biome-recommended, js/oxlint.

Suppress one line with sudsy-disable-next-line no-useless-catch in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
eslint no-useless-catch full