# catch-errors

> A high-order function to catch errors from promises.

Latest version **0.1.1** (published 2018-07-13) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2018-07-13 |
| First published | 2017-09-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Roberto Achar |
| Maintainers | robertoachar |
| Keywords | node, promises, async, await, catch, error, errors |

## Links

- npm: https://www.npmjs.com/package/catch-errors
- Repository: https://github.com/robertoachar/node-catch-errors
- Homepage: https://github.com/robertoachar/node-catch-errors#readme
- Issues: https://github.com/robertoachar/node-catch-errors/issues
- npm.io page: https://npm.io/package/catch-errors

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2018-07-13
- 0.1.0 — 2017-09-28

## README

# catch-errors

Generated by [OSS Project Generator](http://bit.ly/generator-oss-project).

[![NPM Version][npm-badge]][npm-url]
[![License][license-badge]][license-url]

> A high-order function to catch errors from promises.

## Installation

Install package

```bash
$ npm install --save catch-errors
```

## Usage

```js
const fetch = require('node-fetch');
const catchErrors = require('catch-errors');

async function load(username) {
  const response = await fetch(`https://api.github.com/users/${username}`);
  const user = await response.json();
  console.log(user.name);
}

const wrappedLoad = catchErrors(load);

wrappedLoad('robertoachar');
```

## Development

- Cloning the repo

```bash
$ git clone https://github.com/robertoachar/node-catch-errors.git
```

- Installing dependencies

```bash
$ npm install
```

- Running scripts

| Action       | Usage          |
| ------------ | -------------- |
| Linting code | `npm run lint` |

# Author

[Roberto Achar](https://twitter.com/robertoachar)

# License

[MIT](https://github.com/robertoachar/node-catch-errors/blob/master/LICENSE)

[npm-badge]: https://img.shields.io/npm/v/catch-errors.svg
[npm-url]: https://www.npmjs.com/package/catch-errors
[license-badge]: https://img.shields.io/github/license/robertoachar/node-catch-errors.svg
[license-url]: https://opensource.org/licenses/MIT

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