in src/XRayError.js [48:93]
constructor(err) {
this.working_directory = process.cwd(); // eslint-disable-line
let stack = [];
if (err.stack) {
let stackLines = err.stack.replace(/\x7F/g, '%7F').split('\n');
stackLines.shift();
stackLines.forEach((stackLine) => {
let line = stackLine.trim().replace(/\(|\)/g, '');
line = line.substring(line.indexOf(' ') + 1);
let label =
line.lastIndexOf(' ') >= 0
? line.slice(0, line.lastIndexOf(' '))
: null;
let path =
label == undefined || label == null || label.length === 0
? line
: line.slice(line.lastIndexOf(' ') + 1);
path = path.split(':');
let entry = {
path: path[0],
line: parseInt(path[1]),
label: label || 'anonymous',
};
stack.push(entry);
});
}
this.exceptions = [
{
type: err.name?.replace(/\x7F/g, '%7F'),
message: err.message?.replace(/\x7F/g, '%7F'),
stack: stack,
},
];
let paths = new Set();
stack.forEach((entry) => {
paths.add(entry.path);
});
this.paths = Array.from(paths);
}