Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

3 Commits

Repository files navigation

api-error-handler

NPM versionBuild statusTest coverageDependency StatusLicenseDownloadsGittip

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

Example

varerrorHandler=require('api-error-handler');varapi=newexpress.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.

About

Express error handlers for JSON APIs

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages