Comparing version 1.0.7 to 1.0.8
@@ -26,2 +26,3 @@ var util = require('util') | ||
, isLST | ||
, parentStack | ||
, d | ||
@@ -37,4 +38,5 @@ | ||
if (isLST && parentDomain) { | ||
d.parentStack = parentDomain.currentStack | ||
if (isLST) { | ||
parentStack = trycatch.currentStack | ||
trycatch.currentStack = null | ||
} | ||
@@ -44,2 +46,7 @@ | ||
runInDomain(d, tryFn, trycatchit) | ||
if (isLST) { | ||
trycatch.currentStack = parentStack | ||
} | ||
return d | ||
@@ -63,4 +70,4 @@ | ||
} | ||
} else if (d.currentStack) { | ||
e.stack += delimitter + d.currentStack | ||
} else if (trycatch.currentStack) { | ||
e.stack += delimitter + trycatch.currentStack | ||
} | ||
@@ -70,5 +77,4 @@ } | ||
if (isLST && d.parentStack) { | ||
e.parentStack = d.parentStack | ||
if (isLST && parentStack) { | ||
e.parentStack = parentStack | ||
} | ||
@@ -93,3 +99,3 @@ | ||
if (isLST) { | ||
stack = getStack(d) | ||
stack = getUpdatedCurrentStack() | ||
} | ||
@@ -102,3 +108,3 @@ | ||
function newCallback() { | ||
if (isLST && d) d.currentStack = stack | ||
if (isLST) trycatch.currentStack = stack | ||
@@ -109,10 +115,9 @@ runInDomain(d, callback, trycatchitApply, [this, arguments]) | ||
function getStack(parentDomain) { | ||
var stack | ||
function getUpdatedCurrentStack() { | ||
if (!options['long-stack-traces']) return | ||
if (options['long-stack-traces']) { | ||
stack = new Error().stack.substr(6) | ||
if (parentDomain && parentDomain.currentStack) { | ||
stack += delimitter + parentDomain.currentStack | ||
} | ||
// Get new stack and chop off leading non-stack portion | ||
var stack = new Error().stack.substr(6) | ||
if (trycatch.currentStack) { | ||
stack += delimitter + trycatch.currentStack | ||
} | ||
@@ -167,3 +172,2 @@ return stack | ||
var caught | ||
, secondError | ||
@@ -182,6 +186,3 @@ if (!err.catchable) { | ||
if ('function' === typeof catchFn) { | ||
secondError = trycatchit1(catchFn, err) | ||
if (secondError) { | ||
handleException(formatError(normalizeError(secondError))); | ||
} | ||
catchFn(err) | ||
return | ||
@@ -188,0 +189,0 @@ } |
{ | ||
"name": "trycatch", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "An asynchronous domain-based exception handler with long stack traces for node.js", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/CrabDude/trycatch", |
47619