Skip to content

Commit

Permalink
feat: Support mixed eval & non-eval stack traces
Browse files Browse the repository at this point in the history
  • Loading branch information
LachlanStuart authored and davidnpma committed Jun 2, 2017
1 parent dfddbb6 commit 50c8ccc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit 50c8ccc

Please sign in to comment.