Node.js Error module
Simple Node.js module to provide better error handling throughout an application.
Makes use of HTTP error codes to identify different error types.
Install
npm i -S @springworks/error-factory
API:
import { createError } from '@springworks/error-factory';
create({ code = 500, message, cause })
Creates an error with the provided properties.
const err = createError({ code: 404, message: 'Could not find user', cause: db_err });
Tests
Run npm test
to run complete unit tests with Istanbul code coverage.