in src/Errors/XRayError.ts [67:114]
constructor(err: Error) {
this.working_directory = process.cwd(); // eslint-disable-line
const stack: XRayStackEntry[] = [];
if (err.stack) {
const stackLines = err.stack.split("\n");
stackLines.shift();
stackLines.forEach((stackLine) => {
let line = stackLine.trim().replace(/\(|\)/g, "");
line = line.substring(line.indexOf(" ") + 1);
const label =
line.lastIndexOf(" ") >= 0
? line.slice(0, line.lastIndexOf(" "))
: null;
const path =
label == undefined || label == null || label.length === 0
? line
: line.slice(line.lastIndexOf(" ") + 1);
const pathParts = path.split(":");
const entry = {
path: pathParts[0],
line: parseInt(pathParts[1]),
label: label || "anonymous",
};
stack.push(entry);
});
}
this.exceptions = [
{
type: err.name,
message: err.message,
stack: stack,
},
];
const paths = new Set<string>();
stack.forEach((entry) => {
paths.add(entry.path);
});
this.paths = Array.from(paths);
}