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.3.0 to 0.4.0

57

eraro.js

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

if( !util.isError(ex) ) {
if( util.isError(ex) ) {
if( ex.eraro ) return ex;
}
else {
internalex = true

@@ -84,18 +87,40 @@ ex = null

code = _.isString(code) ? code : 'unknown'
details = _.isObject(details) ? details : (_.isObject(msg) && !_.isString(msg) ? msg : {})
msg = buildmessage(msg,msgmap,msgprefix,inspect,code,details)
code = _.isString(code) ? code :
(ex ?
ex.code ? ex.code :
ex.message ? ex.message :
'unknown' : 'unknown')
if( !ex ) {
ex = new Error(msg)
details = _.isObject(details) ? details :
(_.isObject(msg) && !_.isString(msg) ? msg : {})
msg = _.isString(msg) ? msg : null
msg = buildmessage(msg,msgmap,msgprefix,inspect,code,details,ex)
var err = new Error(msg)
if( ex ) {
details.orig$ = null == details.orig$ ? ex : details.orig$
details.message$ = null == details.message$ ? ex.message : details.message$
// drag along properties from original exception
for( var p in ex ) {
err[p] = ex[p]
}
}
ex.code = code
ex[packaje] = true
ex.package = packaje
ex.msg = msg
ex.details = details
ex.callpoint = callpoint( ex, markers )
err.eraro = true
return ex;
err.orig = ex // orig
err.code = code
err[packaje] = true
err.package = packaje
err.msg = msg
err.details = details
err.stack = ex ? ex.stack : err.stack
err.callpoint = callpoint( err , markers )
return err;
}

@@ -167,4 +192,6 @@

// Returns: String; human readable error message
function buildmessage(msg,msgmap,msgprefix,inspect,code,details) {
var message = msgprefix + (_.isString(msg) ? msg : _.isString(msgmap[code]) ? msgmap[code] : code )
function buildmessage(msg,msgmap,msgprefix,inspect,code,details,ex) {
var message = msgprefix + (_.isString(msg) ? msg :
_.isString(msgmap[code]) ? msgmap[code] :
(ex ? ex.message : code) )

@@ -171,0 +198,0 @@ // These are the inserts.

{
"name": "eraro",
"version": "0.3.0",
"version": "0.4.0",
"description": "Create JavaScript Error objects with code strings, context details, and templated messages.",

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

@@ -173,5 +173,5 @@ eraro

Current Version: 0.3.0
Current Version: 0.4.0
Tested on: node 0.10.31
Tested on: node 0.10.35

@@ -178,0 +178,0 @@ [![Build Status](https://travis-ci.org/rjrodger/eraro.png?branch=master)](https://travis-ci.org/rjrodger/eraro)

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