Comparing version 1.1.1 to 1.2.0
@@ -9,2 +9,3 @@ var util = require('util') | ||
, delimitter = '\n ----------------------------------------\n' | ||
, originalError = global.Error | ||
, hasGuardedWithoutLST | ||
@@ -68,6 +69,5 @@ , options | ||
} | ||
} else if (trycatch.currentStack) { | ||
e.stack += delimitter + trycatch.currentStack | ||
} | ||
} | ||
e = formatError(e) | ||
@@ -118,3 +118,3 @@ | ||
obj = {} | ||
Error.captureStackTrace(obj) | ||
originalError.captureStackTrace(obj) | ||
stack = obj.stack.substr(16) | ||
@@ -222,5 +222,5 @@ | ||
// No longer necessary, but nice to have | ||
Error.stackTraceLimit = Infinity | ||
originalError.stackTraceLimit = Infinity | ||
} else { | ||
Error.stackTraceLimit = 10 | ||
originalError.stackTraceLimit = 10 | ||
} | ||
@@ -257,2 +257,24 @@ options['long-stack-traces'] = opts['long-stack-traces'] | ||
function Error(message) { | ||
var err = new originalError(message) | ||
err.__proto__ = this.__proto__ | ||
if (options['long-stack-traces'] && trycatch.currentStack) { | ||
err.stack += delimitter + trycatch.currentStack | ||
} | ||
// formatError(err) | ||
return err | ||
} | ||
Error.__proto__ = originalError | ||
util.inherits(Error, originalError) | ||
global.Error = Error | ||
Object.defineProperty(Error, 'prepareStackTrace', { | ||
get: function() {return originalError.prepareStackTrace} | ||
, set: function(v) {originalError.prepareStackTrace = v} | ||
}) | ||
Object.defineProperty(Error, 'stackTraceLimit', { | ||
get: function() {return originalError.stackTraceLimit} | ||
, set: function(v) {originalError.stackTraceLimit = v} | ||
}) | ||
// Pass callback wrapping function to hookit | ||
@@ -259,0 +281,0 @@ hookit(wrap) |
{ | ||
"name": "trycatch", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "An asynchronous domain-based exception handler with long stack traces for node.js", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/CrabDude/trycatch", |
48391
775