dragon-error-handler
v1.0.0
Published
Simple error handler, for your http requests.
Downloads
1
Readme
What is this?
Get simple error handler for your http requests. This will return HttpResponse, with status 500 (Internal Server Error). You also can use it with Express Js.
Installation
npm i dragon-error-handler --save
Then...
import { errorHandler } from 'dragon-error-handler';
catch(e) {
errorHandler(res, e);
}
Or...
const errorHandler = require("dragon-error-handler");
catch(e) {
errorHandler(res, e);
}
Options
Error Handler should to get 2 params:
- res - HttpResponse (The HttpResponse parameter from your function)
- e - string (The string with your custom error message, or with message from your catch property)