Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 605 Bytes

README.md

File metadata and controls

33 lines (23 loc) · 605 Bytes

micro-error-handler

Error handler middleware for micro.

Installation

npm install --save @mariusc23/micro-error-handler

Usage

const { applyMiddleware } = require('@mariusc23/micro-middleware')
const { errorHandler } = require('@mariusc23/micro-error-handler')

module.exports = applyMiddleware([errorHandler], async (req, res) => {
  return 'Hello world'
})

Example Response

{
  "error": {
    "code": 500,
    "message": "Unknown Error"
  }
}

License

Copyright (c) 2017 Marius Craciunoiu. Licensed under the MIT license.