micro-errors

2.0.0 • Public • Published

micro-errors

CircleCI npm version

A Error Handling for ZEIT's Micro.

yarn add micro-errors

RFC7807

RFC7807 compliant ref: https://tools.ietf.org/html/rfc7807

Usage

const { handleErrors, createError } = require('micro-errors')
 
module.exports = handleErrors({ debug: true })(async (req, res) => {
  throw createError(400, 'Bad Request')
})
 
// HTTP/1.1 400 Bad Request
// Content-Type: application/problem+json
//
// {
//   "type": "about:blank",
//   "title": "Bad Request",
//   "status": 400,
//   "instance": "/foo/bar",
// }

License

MIT

© sugarshin

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.0
    2
  • 1.0.0
    0

Package Sidebar

Install

npm i micro-errors

Weekly Downloads

2

Version

2.0.0

License

MIT

Unpacked Size

127 kB

Total Files

8

Last publish

Collaborators

  • sugarshin