Skip to content

Commit

Permalink
fix stack parsing to skip internal "node:" lines
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Mar 20, 2021
1 parent 512eb19 commit 412d3da
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,12 @@ function parseStackLinesV8(streamIn: StreamIn, lines: string[], ident: string):
// Match on the file location
match = /^(\S+):(\d+):(\d+)$/.exec(line)
if (match) {
let contents = streamIn.readFileSync(match[1], 'utf8')
let contents
try {
contents = streamIn.readFileSync(match[1], 'utf8')
} catch {
break
}
let lineText = contents.split(/\r\n|\r|\n|\u2028|\u2029/)[+match[2] - 1] || ''
let column = +match[3] - 1
let length = lineText.slice(column, column + ident.length) === ident ? ident.length : 0
Expand Down

0 comments on commit 412d3da

Please sign in to comment.