mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 11:22:15 +00:00
⚡ Add line numbers to errors
This commit is contained in:
@@ -127,6 +127,18 @@ return items;`,
|
|||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
items=[{json:{ error: error.message }}];
|
items=[{json:{ error: error.message }}];
|
||||||
} else {
|
} 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);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,6 +120,21 @@ return item;`,
|
|||||||
returnData.push({json:{ error: error.message }});
|
returnData.push({json:{ error: error.message }});
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} 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} | Item Index: ${itemIndex}]`;
|
||||||
|
return Promise.reject(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
error.message = `${error.message} [Item Index: ${itemIndex}]`;
|
||||||
|
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user