Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

trycatch

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trycatch - npm Package Compare versions

Comparing version 1.5.3 to 1.5.4

1

lib/formatError.js

@@ -128,3 +128,4 @@ var path = require('path')

module.exports.formatError = formatError
module.exports.formatStack = formatStack
module.exports.coerceToError = coerceToError
module.exports.addNonEnumerableValue = addNonEnumerableValue

36

lib/trycatch.js
var domain = require('domain')
// , util = require('util')
, path = require('path')

@@ -9,7 +8,7 @@ , hookit = require('hookit')

, formatErrorWithOptions = formatErrorModule.formatError
, formatStackWithOptions = formatErrorModule.formatStack
, coerceToError = formatErrorModule.coerceToError
, addNonEnumerableValue = formatErrorModule.addNonEnumerableValue
, delimitter = '\n ----------------------------------------\n'
, stackHolder = {isTrycatchStackHolder: true}
, originalError = global.Error
, stackHolder = {}
, defaultColors

@@ -135,9 +134,5 @@ , defaultFileNameFilter

// MUST use Error.captureStackTrace to avoid stack filtering
originalError.captureStackTrace(stackHolder)
Error.captureStackTrace(stackHolder)
stack = stackHolder.stack
// When stackTraceLimit === 0, stack is empty
if (stackHolder.stack) {
stack = stackHolder.stack.substr(16)
}
if (trycatch.currentStack) {

@@ -236,2 +231,11 @@ stack += delimitter + trycatch.currentStack

function formatStack(stack) {
return formatStackWithOptions(stack
, {
lineFormatter: trycatch.format
, colors: options.colors
, filter: options.filter
})
}
/* Config Logic */

@@ -244,3 +248,3 @@

// No longer necessary, but nice to have
originalError.stackTraceLimit = options['long-stack-traces'] ? Infinity : 10
Error.stackTraceLimit = options['long-stack-traces'] ? Infinity : 10
}

@@ -283,13 +287,17 @@

Error.prepareStackTrace = prepareStackTrace
function prepareStackTrace(err, frames) {
var stack = FormatStackTrace.call(this, err, frames)
// return stack only for stackHolder from getUpdatedCurrentStack::captureStackTrace
if (err.isTrycatchStackHolder) return stack
if (err === stackHolder) {
// When stackTraceLimit === 0, stack is empty
stack = stack && stack.substr(16)
return formatStack(stack)
}
stack = formatError(err, stack)
if (options['long-stack-traces'] && trycatch.currentStack) {
stack += delimitter + trycatch.currentStack
}
return formatError(err, stack)
return stack
}
originalError.prepareStackTrace = prepareStackTrace

@@ -296,0 +304,0 @@ // Pass callback wrapping function to hookit

{
"name": "trycatch",
"version": "1.5.3",
"version": "1.5.4",
"description": "An asynchronous domain-based exception handler with long stack traces for node.js",

@@ -5,0 +5,0 @@ "homepage": "http://github.com/CrabDude/trycatch",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc