Comparing version 13.0.0-14 to 13.0.0-15
@@ -17,5 +17,5 @@ /** | ||
var getFilepathFromStackEntry = require('./get-filepath-from-stack-entry'); | ||
var getStackTraceWithoutInitialMessage = require('./get-stack-trace-without-initial-message'); | ||
/** | ||
@@ -809,14 +809,25 @@ * helpExecMachineInstance() | ||
// Split the error we got into lines, and remove the first one (the actual error message) | ||
e.stack = e.stack.split('\n'); | ||
var msg = e.stack.shift(); | ||
// Create a new stack trace for the error, using the stack we've been building up in | ||
// _configuredEnvironment in order to preserve the stack after asynchronous jumps. | ||
var newStackTrace = (function() { | ||
// First, strip the error name and message off the stack trace string. | ||
var traceWithoutMessage = getStackTraceWithoutInitialMessage(e); | ||
// Then split it into lines. | ||
var traceLines = traceWithoutMessage.split('\n'); | ||
// Remove lines which refer to non-userland calls | ||
traceLines = removeNonUserlandCallsFromStack(traceLines); | ||
// Intelligently combine those lines with the ones we've been building up | ||
// in the _configuredEnvironment.debug.stack, and get a string back. | ||
var combinedTrace = getCombinedErrorStack(traceLines, liveMachine._configuredEnvironment.debug.stack); | ||
// Finally, add the error name and message back in. | ||
combinedTrace = e.name + ': ' + e.message + '\n' + combinedTrace; | ||
return combinedTrace; | ||
})(); | ||
// Combine the stack we got from the error with those in the environment | ||
e.stack = getCombinedErrorStack(removeNonUserlandCallsFromStack(e.stack), liveMachine._configuredEnvironment.debug.stack); | ||
// Set the stack trace of the error to the new one we created. | ||
e.stack = newStackTrace; | ||
// Indicate that we've already massaged this stack, so we don't do it again. | ||
Object.defineProperty(e, 'stackModified', {value: true}); | ||
// Replace the message | ||
e.stack = msg + '\n' + e.stack; | ||
// If it throws an uncaught error *that we can catch* (i.e. outside of any asynchronous callbacks), | ||
@@ -823,0 +834,0 @@ // then catch it and trigger the configured `error` callback. |
@@ -12,2 +12,3 @@ /** | ||
var determineEffectiveOutputExample = require('./determine-effective-output-example'); | ||
var getStackTraceWithoutInitialMessage = require('./get-stack-trace-without-initial-message'); | ||
@@ -249,3 +250,3 @@ | ||
if (!value.stackModified) { | ||
value.stack = value.message + '\n' + getCombinedErrorStack(value.stack.split('\n').slice(1), machine._configuredEnvironment.debug.stack); | ||
value.stack = value.name + ': ' + value.message + '\n' + getCombinedErrorStack(getStackTraceWithoutInitialMessage(value).split('\n'), machine._configuredEnvironment.debug.stack); | ||
// Indicate that we've already massaged this stack, so we don't do it again. | ||
@@ -265,3 +266,3 @@ Object.defineProperty(value, 'stackModified', {value: true}); | ||
// Make sure the error stack reaches all the way back to the beginning of the run, following asynchronous hops. | ||
value.stack = value.message + '\n' + getCombinedErrorStack(value.stack.split('\n').slice(1), machine._configuredEnvironment.debug.stack); | ||
value.stack = value.name + ': ' + value.message + '\n' + getCombinedErrorStack(getStackTraceWithoutInitialMessage(value).split('\n'), machine._configuredEnvironment.debug.stack); | ||
// Indicate that we've already massaged this stack, so we don't do it again. | ||
@@ -277,3 +278,3 @@ Object.defineProperty(value, 'stackModified', {value: true}); | ||
// Make sure the error stack reaches all the way back to the beginning of the run, following asynchronous hops. | ||
value.stack = value.message + '\n' + getCombinedErrorStack(value.stack.split('\n').slice(1), machine._configuredEnvironment.debug.stack); | ||
value.stack = value.name + ': ' + value.message + '\n' + getCombinedErrorStack(getStackTraceWithoutInitialMessage(value).split('\n'), machine._configuredEnvironment.debug.stack); | ||
// Indicate that we've already massaged this stack, so we don't do it again. | ||
@@ -296,3 +297,3 @@ Object.defineProperty(value, 'stackModified', {value: true}); | ||
// console.log('`' + machine.identity + '`.exit stacks:'); | ||
// console.log('`' + machine.identity + '`.exit ('+exitName+') stacks:'); | ||
// console.log(machine._configuredEnvironment.debug.stack); | ||
@@ -299,0 +300,0 @@ // console.log('====='); |
{ | ||
"name": "machine", | ||
"version": "13.0.0-14", | ||
"version": "13.0.0-15", | ||
"description": "Configure and execute machines", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
220943
27
3504