Comparing version 1.5.5 to 1.5.6
@@ -7,3 +7,9 @@ var path = require('path') | ||
// use colors module, if available | ||
try {colors = require('colors') } catch(err) {} | ||
colors = (function getColors() { | ||
if (process.stdout && process.stdout.isTTY) { | ||
try { | ||
return require('colors') | ||
} catch(err) {} | ||
} | ||
})() | ||
@@ -87,3 +93,4 @@ function formatError(err, stack, options) { | ||
if (line && line.indexOf(options.filter[j]) !== -1) { | ||
line = '' | ||
line = null | ||
break | ||
} | ||
@@ -90,0 +97,0 @@ } |
@@ -64,21 +64,21 @@ var domain = require('domain') | ||
function _trycatchOnError(e) { | ||
e = coerceToError(e) | ||
if (!e.normalized) e.stack = formatError(e, e.stack) | ||
function _trycatchOnError(err) { | ||
err = coerceToError(err) | ||
if (!err.normalized) err.stack = formatError(err, err.stack) | ||
if (!e.catchable) { | ||
if (!err.catchable) { | ||
// Most likely a domain "caught" error | ||
d.exit() | ||
throw e | ||
throw err | ||
} | ||
if (e.caught) { | ||
addNonEnumerableValue(e, 'rethrown', true) | ||
} else addNonEnumerableValue(e, 'caught', true) | ||
if (err.caught) { | ||
addNonEnumerableValue(err, 'rethrown', true) | ||
} else addNonEnumerableValue(err, 'caught', true) | ||
if (isLST) { | ||
if (e.rethrown) { | ||
if (e.parentStack) { | ||
e.stack += delimitter + e.parentStack | ||
e.parentStack = undefined | ||
if (err.rethrown) { | ||
if (err.parentStack) { | ||
err.stack += delimitter + err.parentStack | ||
err.parentStack = undefined | ||
} | ||
@@ -88,5 +88,5 @@ } | ||
if (parentStack) { | ||
if (e.parentStack) e.parentStack = parentStack | ||
if (err.parentStack) err.parentStack = parentStack | ||
else { | ||
addNonEnumerableValue(e, 'parentStack', parentStack) | ||
addNonEnumerableValue(err, 'parentStack', parentStack) | ||
} | ||
@@ -97,3 +97,3 @@ } | ||
d.exit() | ||
handleException(e, parentDomain, catchFn) | ||
handleException(err, parentDomain, catchFn) | ||
} | ||
@@ -165,4 +165,4 @@ } | ||
tryFn.apply(args[0], args[1]) | ||
} catch(e) { | ||
return e | ||
} catch(err) { | ||
return err | ||
} | ||
@@ -175,4 +175,4 @@ } | ||
tryFn.call(null, arg) | ||
} catch(e) { | ||
return e | ||
} catch(err) { | ||
return err | ||
} | ||
@@ -185,4 +185,4 @@ } | ||
tryFn() | ||
} catch(e) { | ||
return e | ||
} catch(err) { | ||
return err | ||
} | ||
@@ -189,0 +189,0 @@ } |
{ | ||
"name": "trycatch", | ||
"version": "1.5.5", | ||
"version": "1.5.6", | ||
"description": "An asynchronous domain-based exception handler with long stack traces for node.js", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/CrabDude/trycatch", |
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
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
54918
957