Change the way parseStack returns the stack to be fiber-aware

This commit is contained in:
Sashko Stubailo
2015-08-06 16:19:19 -07:00
parent 3403b4c77f
commit 247aa77cb4
3 changed files with 12 additions and 5 deletions

View File

@@ -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);
}

View File

@@ -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 " +

View File

@@ -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