Skip to content

New rule: Disallow unnecessary catch clauses (no-useless-catch) #1312

@feross

Description

@feross

https://eslint.org/docs/rules/no-useless-catch

Report pointless catch blocks like this:

try {
  doSomethingThatMightThrow();
} catch (e) {
  throw e;
}

They either indicate that there's extra code that can be removed, or more usefully, that the user intended to do something before re-throwing the error but forgot to do that.

0% ecosystem impact, so this is an easy rule to enable.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions