Fixing error on getCallerFromExisting when invalid error

This commit is contained in:
Fabian Stamm 2018-11-04 20:34:36 +01:00
parent ce8ecbe8c9
commit 37b00fd772

View File

@ -426,6 +426,7 @@ function getCallerFile() {
} }
function getCallerFromExisting(err: Error): { file: string, line: number } { function getCallerFromExisting(err: Error): { file: string, line: number } {
if (!err || !err.stack) return { file: "NOFILE", line: 0 };
let lines = err.stack.split("\n"); let lines = err.stack.split("\n");
let current = path.basename(__filename); let current = path.basename(__filename);
lines.shift();// removing first line lines.shift();// removing first line