https://github.com/kasongoyo/node-custom-error
Module that extends nodejs native error to create multiple domain errors
https://github.com/kasongoyo/node-custom-error
Last synced: 10 months ago
JSON representation
Module that extends nodejs native error to create multiple domain errors
- Host: GitHub
- URL: https://github.com/kasongoyo/node-custom-error
- Owner: kasongoyo
- Created: 2018-10-05T06:17:03.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-17T18:27:11.000Z (about 7 years ago)
- Last Synced: 2025-01-11T02:29:11.108Z (12 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node Custom Errors
Nodejs has native error object `Error` which is very generic and does not
offer a way to differentiate different types of errors using object
types(prototype hierarchy). As the result many nodejs developer rely on
error message as the way to differentiate between different types of errors, something
which is verbose and does not scale well.
This module extends Nodejs native error to create various custom error
types based on common domain errors such as `ValidationError`, `ResourceLockedError`,
`ForbiddenError`, `ConflictError`, `NotFoundError` etc.
**Note**
Some errors can only be generated if you're using mongoose and mongodb.
## Custom Errors