From 50c8ccca14935fe5c6fd2f44608f22fe27c2a563 Mon Sep 17 00:00:00 2001 From: "lachlan.stuart" Date: Thu, 1 Jun 2017 12:35:11 +1200 Subject: [PATCH] feat: Support mixed eval & non-eval stack traces --- src/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 2ccf6f0..3d6d3bb 100755 --- a/src/index.js +++ b/src/index.js @@ -61,10 +61,16 @@ export class RedBoxError extends Component { let fixedLines = [stackLines.shift()] // The rest needs to be fixed. for (let stackLine of stackLines) { - let [, atSomething, file, rowColumn] = stackLine.match( + const evalStackLine = stackLine.match( /(.+)\(eval at (.+) \(.+?\), .+(\:[0-9]+\:[0-9]+)\)/ ) - fixedLines.push(`${atSomething} (${file}${rowColumn})`) + if (evalStackLine) { + const [, atSomething, file, rowColumn] = evalStackLine + fixedLines.push(`${atSomething} (${file}${rowColumn})`) + } else { + // TODO: When stack frames of different types are detected, try to load the additional source maps + fixedLines.push(stackLine) + } } error.stack = fixedLines.join('\n') this.state = { error, mapped: true }