# try-catch

> functional try-catch wrapper

Latest version **4.1.1** (published 2026-09-02) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.1.1 |
| Published | 2026-09-02 |
| First published | 2014-12-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22 |
| Dependencies | 0 |
| Unpacked size | 5.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19 |
| Author | coderaiser |
| Maintainers | coderaiser |

## Links

- npm: https://www.npmjs.com/package/try-catch
- Repository: https://github.com/coderaiser/try-catch
- Homepage: http://github.com/coderaiser/try-catch
- Issues: https://github.com/coderaiser/try-catch/issues
- npm.io page: https://npm.io/package/try-catch

## Recent versions

- 4.1.1 (latest) — 2026-09-02
- 4.1.0 — 2026-09-02
- 4.0.9 — 2026-01-28
- 4.0.8 — 2026-01-28
- 4.0.7 — 2026-01-04
- 4.0.6 — 2025-12-31
- 4.0.5 — 2025-12-31
- 4.0.4 — 2025-12-30
- 4.0.3 — 2025-12-30
- 4.0.2 — 2025-12-30
- 4.0.1 — 2025-12-30
- 4.0.0 — 2025-12-30
- 3.0.1 — 2022-03-07
- 3.0.0 — 2020-02-24
- 2.0.1 — 2019-09-12
- … 2 more at https://npm.io/package/try-catch/versions

## README

# Try Catch [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]

[NPMIMGURL]: https://img.shields.io/npm/v/try-catch.svg?style=flat
[NPMURL]: https://npmjs.org/package/try-catch "npm"
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[CoverageURL]: https://coveralls.io/github/coderaiser/try-catch?branch=master
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/try-catch/badge.svg?branch=master&service=github
[BuildStatusURL]: https://github.com/coderaiser/try-catch/actions?query=workflow%3A%22Node+CI%22 "Build Status"
[BuildStatusIMGURL]: https://github.com/coderaiser/try-catch/workflows/Node%20CI/badge.svg

Functional `try-catch` wrapper

## Install

```
npm i try-catch
```

## Example

```js
import {tryCatch} from 'try-catch';

const {parse} = JSON;
const [error, result] = tryCatch(parse, 'hello');

if (error)
    console.error(error.message);
```

## Related

- [try-to-catch](https://github.com/coderaiser/try-to-catch "TryToCatch") - functional try-catch wrapper for promises.

## License

MIT

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