http-smart-error
v4.0.1
Published
Subclass of SmartError for handling http errors.
Downloads
330
Readme
http-smart-error
Subclass of SmartError for handling http errors.
Installation
npm install http-smart-error --save
Usage
import HttpSmartError from 'http-smart-error';
console.log(HttpSmartError.create(400)); // Http error with 400 status code, message "Bad request" and code "ERR_BAD_REQUEST"
console.log(HttpSmartError.create(403, 'User has no permissions to do that.', 'no_permission', { missing_permission: 'read.something'})); // Http error with 403 status code, message "User has no permissions to do that.", code "ERR_NO_PERMISSION" and extra field "missing_permission" with "read.something" value.
Migration to V4
smart-error
module is as peer dependency. It needs to be installed separately.