diff --git a/tools/buildmessage.js b/tools/buildmessage.js index 287782424b..6d638c482f 100644 --- a/tools/buildmessage.js +++ b/tools/buildmessage.js @@ -433,7 +433,13 @@ var error = function (message, options) { if ('useMyCaller' in info) { if (info.useMyCaller) { - info.stack = parseStack.parse(new Error()).slice(2); + const { + insideFiber, + outsideFiber + } = parseStack.parse(new Error()); + + // Concatenate and get rid of lines about Future and buildmessage + info.stack = outsideFiber.concat(insideFiber).slice(2); if (typeof info.useMyCaller === 'number') { info.stack = info.stack.slice(info.useMyCaller); } diff --git a/tools/selftest.js b/tools/selftest.js index 1205180b9f..e4f27836dc 100644 --- a/tools/selftest.js +++ b/tools/selftest.js @@ -1805,7 +1805,7 @@ var runTests = function (options) { testList.notifyFailed(test); if (failure instanceof TestFailure) { - var frames = parseStack.parse(failure); + var frames = parseStack.parse(failure).outsideFiber; var relpath = files.pathRelative(files.getCurrentToolsDir(), frames[0].file); Console.rawError(" => " + failure.reason + " at " + diff --git a/tools/utils/parse-stack.js b/tools/utils/parse-stack.js index c570d5aff8..2cdc5c72a0 100644 --- a/tools/utils/parse-stack.js +++ b/tools/utils/parse-stack.js @@ -38,9 +38,10 @@ export function parse(err) { const outsideFiber = parseStackFrames(frames); const insideFiber = parseStackFrames(frames.slice(indexOfFiberSplit + 1)); - // Put the frames below the split at the top of the printed stack trace, since - // they are more likely to contain the code that actually threw the error. - return insideFiber.concat(outsideFiber); + return { + insideFiber, + outsideFiber + }; } // Decorator. Mark the point at which a stack trace returned by