Comparing version 0.2.1 to 0.2.2
27
index.js
require('tinycolor'); | ||
if (typeof(''.bgDefault) !== 'function') { | ||
require('tinycolor'); | ||
} | ||
var util = require('util'); | ||
@@ -154,4 +157,6 @@ var pkgLookup = require('package-lookup'); | ||
for (var property in this) { | ||
if (!(property === 'name' || property === 'message' || | ||
(property === 'cause' && cause))) { | ||
if (!((property === 'cause' && cause) || | ||
property === 'name' || | ||
property === 'message' || | ||
property === 'stack')) { | ||
var value = this[property]; | ||
@@ -168,3 +173,3 @@ if (typeof(value) !== 'function') { | ||
if (cause) { | ||
if (cause && typeof(cause.toJSON) === 'function') { | ||
self.error_cause = cause.toJSON(); | ||
@@ -301,2 +306,3 @@ } | ||
var stack = ''; | ||
var stackFirstAt; | ||
@@ -313,3 +319,3 @@ if (error instanceof Error) { | ||
stack = '' + [error.stack]; | ||
var stackFirstAt = stack.match(/\n.* +at +/); | ||
stackFirstAt = stack.match(/\n.* +at +/); | ||
if (stackFirstAt) { | ||
@@ -340,2 +346,13 @@ stack = stack.substring(stackFirstAt.index + 1); | ||
} | ||
if (typeof(error.stack) === 'string') { | ||
stack = '' + [error.stack]; | ||
stackFirstAt = stack.match(/\n.* +at +/); | ||
if (stackFirstAt) { | ||
stack = stack.substring(stackFirstAt.index + 1); | ||
delete data.stack; | ||
} else { | ||
stack = ''; | ||
} | ||
} | ||
} else { | ||
@@ -342,0 +359,0 @@ name = 'Error value'; |
{ | ||
"name": "ferro", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Ferocious Error Handling", | ||
@@ -5,0 +5,0 @@ "repository": { |
12735
346