# custom-error-class

> Straightforward ES6 class you can extend to make proper custom errors

Latest version **1.0.0** (published 2019-01-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install custom-error-class
pnpm add custom-error-class
yarn add custom-error-class
bun add custom-error-class
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-01-24 |
| First published | 2019-01-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 42 |
| Author | Mathias Buus |
| Maintainers | mafintosh |

## Links

- npm: https://www.npmjs.com/package/custom-error-class
- Repository: https://github.com/mafintosh/custom-error-class
- Issues: https://github.com/mafintosh/custom-error-class/issues
- npm.io page: https://npm.io/package/custom-error-class

## Recent versions

- 1.0.0 (latest) — 2019-01-24

## README

# custom-error-class

Straightforward ES6 class you can extend to make custom errors that are all `instanceof` Error with proper stacks.

```
npm install custom-error-class
```

## Usage

``` js
const CustomError = require('custom-error-class')

class MyError extends CustomError {
  constructor () {
    super('an error happened')
    this.code = 'SOME_CODE'
  }
}

// Use this error as you normally would.
throw new MyError()
```

Credits to [@pfrazee](https://github.com/pfrazee) who wrote most of it.

## License

MIT

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