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

handlerr

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

handlerr

A simple Node.js utility for handling errors

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Handlerr

A simple Node.js utility for handling errors

Install

It's just an npm package, so use npm.

$ npm install --save handlerr

Usage

Handlerr provides a helper functions for wrapping Node.js-style callbacks. By default, Handlerr will just use console.error on a stack trace whenever an error occurs. For more errors see handlers.

For example:

var handle = require('handlerr')
  , fs = require('fs')
  ;

fs.readFile('myfile.txt', handle(function(file) {
  console.log('myfile.txt is ' + file.length + ' characters long');
}));

If you prefer to throw errors, then you may use handle.throw like so:

db.connect(handle.throw(function(db) {
  // ...
}));

Alternatively, if you want to throw errors by default, you can just grab .throw in your require call:

var handle = require('handlerr').throw;

Handlers

  • handle: The default handler which will use console.error to report any errors.

  • handle.throw: For errors that should stop the system. This will just throw any errors that come through.

  • handle.custom(handler): For creating custom error handlers. The handler function takes an error argument.

Keywords

FAQs

Package last updated on 29 Sep 2014

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