1.0.0 • Published 3 years ago

dragon-error-handler v1.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
3 years ago

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)