Node Exceptions

Throwing errors in Javascript does not give much information about the error type as it is really hard to throw custom exceptions. Node Exceptions is a tiny wrapper which will let you extend the Error class and throw custom errors.
Why custom errors
Errors are thrown anywhere inside the code and handling them properly is required. For example you have an HTTP application, which can throw multiple errors and in order to handle those errors gracefully, you need to know the error types or their names.
Install
npm i --save node-exceptions
Creating custom errors
const NE = LogicalException {} try throw 'Something bad happened' catch e console // equals 500 console // equals MyCustomError console // Something bad happened console // Error stack with correct reference to filepath and linenum console // MyCustomError: Something bad happened
Custom error status
It is also possible to have a custom error status when throwing exceptions.
const NE = LogicalException {} try throw 'Page not found' 404 catch e console // equals 404
API Docs
Access complete API Docs here