# c-e

> Making custom error classes

Latest version **1.0.4** (published 2018-08-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install c-e
pnpm add c-e
yarn add c-e
bun add c-e
```

## 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.4 |
| Published | 2018-08-19 |
| First published | 2017-12-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 0 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | astur |
| Maintainers | astur |
| Keywords | error, custom |

## Links

- npm: https://www.npmjs.com/package/c-e
- Repository: https://github.com/astur/c-e
- Homepage: https://github.com/astur/c-e#readme
- Issues: https://github.com/astur/c-e/issues
- npm.io page: https://npm.io/package/c-e

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 1.0.4 (latest) — 2018-08-19
- 1.0.3 — 2018-06-06
- 1.0.2 — 2018-06-02
- 1.0.1 — 2018-01-02
- 1.0.0 — 2017-12-20
- 0.0.0 — 2017-12-20

## README

# c-e

Making custom error classes

[![Build Status][travis-image]][travis-url]
[![NPM version][npm-image]][npm-url]

## Install

```bash
npm i c-e
```

## Usage

```js
const ce = require('c-e');

const CustomError = ce();
const NestedError = ce('NestedError', CustomError);

CustomError.name === 'CustomError';         // true
NestedError.name === 'NestedError';         // true
new CustomError().name === 'CustomError';   // true
new NestedError().name === 'NestedError';   // true
new NestedError('test').message === 'test'; // true
new NestedError() instanceof Error;         // true
new NestedError() instanceof CustomError;   // true
new NestedError() instanceof NestedError;   // true

const MyError = ce('MyError', Error, function(a, b){
    this.message = `${a + b}`;
    this.a = a;
    this.b = b;
});
new MyError(1, 2).message === '3'; // true
new MyError(1, 2).a === 1;         // true
new MyError(1, 2).b === 2;         // true
```

## License

MIT

[npm-url]: https://npmjs.org/package/c-e
[npm-image]: https://badge.fury.io/js/c-e.svg
[travis-url]: https://travis-ci.org/astur/c-e
[travis-image]: https://travis-ci.org/astur/c-e.svg?branch=master

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