# safety-catch

> Small module that makes sure your catch, caught an actual error and not a programming mistake or assertion

Latest version **1.0.3** (published 2026-03-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install safety-catch
pnpm add safety-catch
yarn add safety-catch
bun add safety-catch
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2026-03-12 |
| First published | 2021-07-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 35 |
| Author | Mathias Buus |
| Maintainers | mafintosh |

## Links

- npm: https://www.npmjs.com/package/safety-catch
- Repository: https://github.com/mafintosh/safety-catch
- Issues: https://github.com/mafintosh/safety-catch/issues
- npm.io page: https://npm.io/package/safety-catch

## Recent versions

- 1.0.3 (latest) — 2026-03-12
- 1.0.2 — 2022-04-01
- 1.0.1 — 2021-07-15
- 1.0.0 — 2021-07-15

## README

# safety-catch

Small module that makes sure your catch, caught an actual error and not a programming mistake or assertion.

```
npm install safety-catch
```

Triggers an unhandled error in the next tick, when you pass it an SyntaxError, TypeError, AssertionError and other builtins.

## Usage

``` js
const safetyCatch = require('safety-catch')

try {
  foo.bar()
} catch (err) {
  // Was this a programming mistake and should you crash your program?
  // Ask the safety catch
  safetyCatch(err)

  console.log('Actual error')
}
```

## License

MIT

---
_Source: https://npm.io/package/safety-catch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
