Node Errors
Extended Node.JS Error classes, allowing you to easily handle common errors in a web application. Predefined error messages and codes will save you some time and boilerplate code.
Furthermore, it contains a common error handler middleware, which complements forming responses based on the errors that had been passed
Error types
Name | Message | Code | Payload | Signature |
---|---|---|---|---|
Common | null | 400 | null | message , code |
Auth | Not authorized | 401 | null | message |
Forbidden | Forbidden | 403 | null | message |
NotFound | Not Found | 404 | null | message |
BadRequest | Bad Request | 400 | null | payload |
Uninitialized | Uninitialized | 500 | null | |
Internal | Internal Server Error | 500 | null | message |
Usage
One of the many usage cases
var Errors = ;var express = ;var app = ; var router = express; // custom router, for now it's in the same file, but it's more// and more common to have components-based web servers, so let's keep it// that wayrouter ; app;app;