New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.2 to 0.1.3

32

eraro.js

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

var util = require('util')
// Remove unwanted lines containing markers

@@ -53,3 +55,13 @@ function cleanstack( error, markers ) {

return function ( code, msg, details ) {
return function( ex, code, msg, details ) {
var internalex = false
if( !util.isError(ex) ) {
internalex = true
ex = null
code = arguments[0]
msg = arguments[1]
details = arguments[2]
}
code = 'string' === typeof(code) ? code : 'unknown'

@@ -64,16 +76,20 @@

var e = new Error(msg)
if( !ex ) {
ex = new Error(msg)
}
e[packaje] = true
e.package = packaje
ex[packaje] = true
ex.package = packaje
e.code = code
e.details = details || {}
ex.code = code
ex.details = details || {}
// clean the stack
e.stack = cleanstack( e, markers )
if( internalex ) {
ex.stack = cleanstack( ex, markers )
}
return e;
return ex;
}
}
{
"name": "eraro",
"version": "0.1.2",
"version": "0.1.3",
"description": "Create JavaScript Error objects with code strings, context details, and uncluttered stacktraces",

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

@@ -31,2 +31,6 @@ eraro

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

@@ -46,3 +50,3 @@

Current Version: 0.1.2
Current Version: 0.1.3

@@ -49,0 +53,0 @@ Tested on: node 0.10.26

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

var e1 = eraro('c1','m1',{a:1})
//console.log(e1)

@@ -34,1 +33,16 @@ assert.equal('foo: m1',e1.message)

assert.equal("{ [Error: foo: unknown] foo: true, package: 'foo', code: 'unknown', details: {} }",util.inspect(e4))
var x0 = new Error('x0')
var e5 = eraro(x0)
assert.equal("{ [Error: x0] foo: true, package: 'foo', code: 'unknown', details: {} }",util.inspect(e5))
var x1 = new Error('x1')
var e6 = eraro(x1,'c4')
assert.equal("{ [Error: x1] foo: true, package: 'foo', code: 'c4', details: {} }",util.inspect(e6))
var x2 = new Error('x2')
var e7 = eraro(x2,'c5',{a:3})
assert.equal("{ [Error: x2] foo: true, package: 'foo', code: 'c5', details: { a: 3 } }",util.inspect(e7))
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