mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
⚡ Add line numbers to errors
This commit is contained in:
@@ -127,6 +127,18 @@ return items;`,
|
||||
if (this.continueOnFail()) {
|
||||
items=[{json:{ error: error.message }}];
|
||||
} else {
|
||||
// Try to find the lien number which contains the error and attach to error message
|
||||
const stackLines = error.stack.split('\n');
|
||||
if (stackLines.length > 0) {
|
||||
const lineParts = stackLines[1].split(':');
|
||||
if (lineParts.length > 2) {
|
||||
const lineNumber = lineParts.splice(-2, 1);
|
||||
if (!isNaN(lineNumber)) {
|
||||
error.message = `${error.message} [Line ${lineNumber}]`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.reject(error);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user