Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eerr

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eerr

Error Event Handller

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

eErr

Error Event Handller.

Installation

npm install --save eerr

Usage

example

var eerr = require('eerr');

eerr.setup({
  badrequest: { status: 400, message: 'Bad Request.' },
  unauthorized: { status: 401, message: 'Unauthorized.' },  
  forbidden: { status: 403, message: 'Forbidden' },
  notfound: { status: 404, message: 'Not Found.' },
  internalservererror: { status: 500, message: 'Internal Server Error.' },
  gatewaytimeout: { status: 504, message: 'Gateway Timeout.' }
});

// error code event.
eerr.on('badrequest', function(err) {
  console.log('bad request!');
});
// error status event.
eerr.on('404', function(err) {
  console.log('not found!');
});
// error status event.
eerr.on('4XX', function(err) {
  console.log('client error!');
});

var err = eerr('notfound');
console.log(err.name, err.code, err.status, err.message, err.stack);

// -- output
// not found!
// client error!
// Error notfound 404 Not Found ErrorStack...

Contribution

  1. Fork it ( https://github.com/iyu/eerr/fork )
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Run test suite with the npm test; npm run-script jshint command and confirm that it passes
  6. Create new Pull Request

Keywords

FAQs

Package last updated on 09 Feb 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc