Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andykog/enhancederror
Enhanced JavaScript Error
https://github.com/andykog/enhancederror
Last synced: about 1 month ago
JSON representation
Enhanced JavaScript Error
- Host: GitHub
- URL: https://github.com/andykog/enhancederror
- Owner: andykog
- Created: 2016-09-05T12:28:48.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-07T16:17:13.000Z (over 8 years ago)
- Last Synced: 2024-11-16T10:47:58.719Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/enhancederror
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
```