https://github.com/andykog/enhancederror
Enhanced JavaScript Error
https://github.com/andykog/enhancederror
Last synced: 4 months ago
JSON representation
Enhanced JavaScript Error
- Host: GitHub
- URL: https://github.com/andykog/enhancederror
- Owner: andykog
- Created: 2016-09-05T12:28:48.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-09-07T16:17:13.000Z (almost 9 years ago)
- Last Synced: 2025-02-23T02:37:36.498Z (5 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
```