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

eraro

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eraro

Create JavaScript Error objects with code strings, context details, and uncluttered stacktraces

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

eraro

Create JavaScript Error objects with code strings, context details, and uncluttered stacktraces

For use in library modules to generate contextual errors. Your library module can return an error code for programmatic inspection by calling code, and error details as a context object for custom messages and fault inspection.

Stack trace lines referring to eraro itself, and your library, are removed. This means that the first line of the stack trace refers to the position in user code where your library was called.


var error = require('eraro')()

throw error('code_string')

// provide a user message
throw error('code_string', 'Message text.')

// supply context details for error
throw error('code_string', 'Message text.', {foo:1, bar:2})

throw error('code_string', {foo:1, bar:2})


// extend and existing Error object
var ex = new Error('Another message.')
throw error(ex,'code_string',{details:'data'})

The Error object has the following additional properties:

  • code: code string
  • details: context details object

Support

If you're using this module, feel free to contact me on twitter if you have any questions! :) @rjrodger

Current Version: 0.1.3

Tested on: node 0.10.26

Build Status

...more docs to follow...

Keywords

FAQs

Package last updated on 29 Apr 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