# no-useless-catch

Rule `sonarjs/no-useless-catch`. "catch" clauses should do more than rethrow

- Source: sonarjs
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 6.2M weekly downloads of presets that enable it
- Trend: +62.1% last quarter
- Rank: #1328 by reach, #629 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `sonarjs/no-useless-catch` | yes | no | package `eslint-plugin-sonarjs` | [docs](https://rules.sonarsource.com/javascript/RSPEC-2737/) |

## Code examples

### Incorrect: the rule reports this

```js
try {
  doSomething();
} catch (ex) {  // Noncompliant
  throw ex;
}
```

### Correct: the rule accepts this

```js
try {
  doSomething();
} catch (ex) {
  console.err(ex);
  throw ex;
}
```

```js
doSomething();
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
export default [
  {
    rules: {
      "sonarjs/no-useless-catch": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [SonarJS recommended](https://lintradar.dev/presets/sonarjs-recommended.md) | ESLint | `eslint-plugin-sonarjs` | 230 | 6.2M | +62.1% |

## Related rules

- [eslint/no-useless-catch](https://lintradar.dev/rules/eslint/no-useless-catch.md): Disallow unnecessary `catch` clauses
- [sonarjs/no-use-of-empty-return-value](https://lintradar.dev/rules/sonarjs/no-use-of-empty-return-value.md): The return value of void functions should not be used
- [sonarjs/no-useless-increment](https://lintradar.dev/rules/sonarjs/no-useless-increment.md): Values should not be uselessly incremented
- [sonarjs/no-unused-vars](https://lintradar.dev/rules/sonarjs/no-unused-vars.md): Unused local variables and functions should be removed
- [sonarjs/no-useless-intersection](https://lintradar.dev/rules/sonarjs/no-useless-intersection.md): Type intersections should use meaningful types
- [sonarjs/no-unused-collection](https://lintradar.dev/rules/sonarjs/no-unused-collection.md): Collection contents should be used

---

Web page: https://lintradar.dev/rules/sonarjs/no-useless-catch. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
