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 - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

7

eraro.js

@@ -41,4 +41,5 @@ /* Copyright (c) 2014 Richard Rodger, MIT License */

var packaje = options.package || 'unknown'
var markers = options.markers || []
var msgprefix = options.package ? options.package+': ' : ''
var packaje = options.package || 'unknown'
var markers = options.markers || []

@@ -54,3 +55,3 @@ var filename = module.filename

code = 'string' === typeof(code) ? code : 'unknown'
msg = 'string' === typeof(msg) ? msg : code
msg = msgprefix + ('string' === typeof(msg) ? msg : code)
details = 'object' === typeof(details) ? details : {}

@@ -57,0 +58,0 @@

{
"name": "eraro",
"version": "0.1.0",
"version": "0.1.1",
"description": "Create JavaScript Error objects with code strings, context details, and uncluttered stacktraces",

@@ -5,0 +5,0 @@ "main": "eraro.js",

@@ -6,5 +6,13 @@ eraro

For use in library modules to generate contextual errors.
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.
```JavaScript

@@ -32,5 +40,16 @@

The stacktrace is cleaned by removing references to the calling module. Thus the first line of the stack trace refers to the location in user code where the error was triggered.
### Support
If you're using this module, feel free to contact me on twitter if you have any questions! :) [@rjrodger](http://twitter.com/rjrodger)
Current Version: 0.1.1
Tested on: node 0.10.26
[![Build Status](https://travis-ci.org/rjrodger/eraro.png?branch=master)](https://travis-ci.org/rjrodger/eraro)
...more docs to follow...

@@ -17,3 +17,3 @@ /* Copyright (c) 2014 Richard Rodger, MIT License */

assert.equal('m1',e1.message)
assert.equal('foo: m1',e1.message)
assert.equal('foo',e1.package)

@@ -25,10 +25,10 @@ assert.equal(true,e1.foo)

var e2 = eraro('c2',{a:2})
assert.equal("{ [Error: c2] foo: true, package: 'foo', code: 'c2', details: {} }",util.inspect(e2))
assert.equal("{ [Error: foo: c2] foo: true, package: 'foo', code: 'c2', details: {} }",util.inspect(e2))
var e3 = eraro('c3')
assert.equal("{ [Error: c3] foo: true, package: 'foo', code: 'c3', details: {} }",util.inspect(e3))
assert.equal("{ [Error: foo: c3] foo: true, package: 'foo', code: 'c3', details: {} }",util.inspect(e3))
var e4 = eraro()
assert.equal("{ [Error: unknown] foo: true, package: 'foo', code: 'unknown', details: {} }",util.inspect(e4))
assert.equal("{ [Error: foo: unknown] foo: true, package: 'foo', code: 'unknown', details: {} }",util.inspect(e4))
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