Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including micro-errors with all npm packages installed. Try it out:

require("micro/package.json"); // micro is a peer dependency. var microErrors = require("micro-errors")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

micro-errors v2.0.0

A Error Handling for ZEIT's Micro


CircleCI npm version

A Error Handling for ZEIT's Micro.

yarn add micro-errors


RFC7807 compliant ref:


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",
// }



© sugarshin

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free