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 @microservice/error-handling with all npm packages installed. Try it out:

var errorHandling = require("@microservice/error-handling")

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

@microservice/error-handling v1.0.0

Common error handling logic


var errorHandling = require('service-error-handling');

  mongo: false // convert (some) mongo errors to HTTP codes -- defaults to true
  development: process.env.NODE_ENV !== 'production' // use development errorHandler -- defaults to false
  title: 'My Title!' // custom title for the development-only error page

errors are rendered with basic content negotiation support (json and html)

in production errors messages are only exposed if err.expose is set to true and a status code and message are provided. otherwise it defaults to a 500 Internal Server Error.

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