Comparing version 0.2.6 to 0.2.7
@@ -40,2 +40,22 @@ | ||
// Errors captured in async.parallel() or async.series() will | ||
// end up in an object or an array, where default error serialization | ||
// is next to useless, so let's serialize their stacks here. | ||
// Exported and overridable. | ||
exports.laehStringify = function(e) { | ||
var o = e instanceof Object; | ||
var a = Array.isArray(e); | ||
if(o || a) { | ||
for(var k in (o ? Object.keys(e) : e)) | ||
if(e[k] instanceof Error) | ||
e[k] = String(e[k].stack); | ||
} | ||
return JSON.stringify(e); | ||
} | ||
// Check, wrap and throw error (optional convenience method) | ||
@@ -48,3 +68,3 @@ // e: object to throw | ||
if(!(e instanceof Error)) | ||
e = new Error(e instanceof Object ? JSON.stringify(e) : e); | ||
e = new Error(e instanceof Object ? exports.laehStringify(e) : e); | ||
if(meta) | ||
@@ -88,3 +108,3 @@ e.meta = meta; | ||
if(!(e instanceof Error)) | ||
e = new Error(e instanceof Object ? JSON.stringify(e) : e); | ||
e = new Error(e instanceof Object ? exports.laehStringify(e) : e); | ||
@@ -91,0 +111,0 @@ e.prev = prev; |
@@ -6,3 +6,3 @@ { | ||
"keywords": [ "error", "handling", "asynchronous" ], | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"homepage": "http://github.com/ypocat/laeh2", | ||
@@ -9,0 +9,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18331
226
1