Skip to content

Commit

Permalink
pretty stacktrace: catch uncaught exception on node internal files
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaudan committed Apr 24, 2020
1 parent 5d75ad3 commit 9058e6a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/processors/pretty-stacktrace-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@ export class PrettyStacktraceProcessor extends DisplayProcessor {

private retrieveErrorContext(filename: string, lineNb: number, columnNb: number) {
const logs = [];
const fileLines = fs.readFileSync(filename, "utf-8")
.split("\n");
let fileLines;
try {
fileLines = fs.readFileSync(filename, "utf-8")
.split("\n");
} catch (error) {
return `jasmine-spec-reporter: unable to open '${filename}'\n${error}`;
}
for (let i = 0; i < fileLines.length; i++) {
const errorLine = lineNb - 1;

Expand Down

0 comments on commit 9058e6a

Please sign in to comment.