# handle-callback-err

Rule `eslint/handle-callback-err`. Require error handling in callbacks

- Source: eslint
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: no
- Deprecated: yes
- Reach: 1.2M weekly downloads of presets that enable it
- Trend: +5.8% last quarter
- Rank: #1567 by reach, #1485 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `handle-callback-err` | no | no | package `eslint` | [docs](https://eslint.org/docs/latest/rules/handle-callback-err) |

## Code examples

### Incorrect: the rule reports this

```js
function loadData (err, data) {
    doSomething();
}
```

### Correct: the rule accepts this

```js
function loadData (err, data) {
    if (err) {
        console.log(err.stack);
    }
    doSomething();
}

function generateError (err) {
    if (err) {}
}
```

```js
function loadData (error, data) {
    if (error) {
        console.log(error.stack);
    }
    doSomething();
}
```

Examples from the ESLint documentation.

## Enable it

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

```js
export default [
  {
    rules: {
      "handle-callback-err": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [React Native](https://lintradar.dev/presets/react-native.md) | ESLint | `@react-native/eslint-config` | 79 | 1.2M | +5.8% |

## Related rules

- [node/handle-callback-err](https://lintradar.dev/rules/node/handle-callback-err.md): Require error handling in callbacks
- [eslint/consistent-this](https://lintradar.dev/rules/eslint/consistent-this.md): Enforce consistent naming when capturing the current execution context
- [eslint/no-invalid-this](https://lintradar.dev/rules/eslint/no-invalid-this.md): Disallow use of `this` in contexts where the value of `this` is `undefined`
- [eslint/max-depth](https://lintradar.dev/rules/eslint/max-depth.md): Enforce a maximum depth that blocks can be nested
- [eslint/max-lines](https://lintradar.dev/rules/eslint/max-lines.md): Enforce a maximum number of lines per file
- [eslint/max-params](https://lintradar.dev/rules/eslint/max-params.md): Enforce a maximum number of parameters in function definitions

---

Web page: https://lintradar.dev/rules/eslint/handle-callback-err. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
