Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/andykog/enhancederror

Enhanced JavaScript Error
https://github.com/andykog/enhancederror

Last synced: about 1 month ago
JSON representation

Enhanced JavaScript Error

Awesome Lists containing this project

README

        

EnhancedError
------------

Adds missing Error's feature in JS - ability
to provide error code or other information;

Feels like natural Error when printing in console.

```
npm install --save enhancederror
```

commonjs:

```js
import EnhancedError from 'enhancederror';
```

umd:

```js

```

```js
const a = new EnhancedError('Message', 10085);

const b = new EnhancedError({
message: 'OtherMessage',
code: 10085,
customProp: true
});

a.code === b.code; // true

b.otherProp; // true

a instanceof EnhancedError; // true
a instanceof Error; // true
```