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

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

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