Socket
Socket
Sign inDemoInstall

api-error-handler

Package Overview
Dependencies
1
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-error-handler

Express error handlers for JSON APIs


Version published
Maintainers
1
Weekly downloads
1,170
increased by28.43%
Install size
17.7 kB

Weekly downloads

Readme

Source

api-error-handler

NPM version Build status Test coverage Dependency Status License Downloads Gittip

An error handler for JSON APIs, meant to be used with http-errors-style errors.

Example

var errorHandler = require('api-error-handler');

var api = new express.Router();
api.get('/users/:userid', function (req, res, next) {

});

api.use(errorHandler());

app.use('/api', api);

API

.use(errorHandler([options]))

Currently no options.

Errors

4xx errors are exposed to the client. Properties exposed are:

  • message
  • type
  • name
  • code
  • status

5xx errors are not exposed to the client. Instead, they are given a generic message as well as the type.

Keywords

FAQs

Last updated on 10 Dec 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc