1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #2894 from node-red-hitachi/fix-error-report-on-node-load

Fix error report on  node load
This commit is contained in:
Nick O'Leary 2021-03-11 16:01:06 +00:00 committed by GitHub
commit 5bbd3d6273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -385,10 +385,17 @@ function loadNodeSet(node) {
var stack = err.stack; var stack = err.stack;
var message; var message;
if (stack) { if (stack) {
var i = stack.indexOf(node.file); var filePath = node.file;
try {
filePath = fs.realpathSync(filePath);
}
catch (e) {
// ignore canonicalization error
}
var i = stack.indexOf(filePath);
if (i > -1) { if (i > -1) {
var excerpt = stack.substring(i+node.file.length+1,i+node.file.length+20); var excerpt = stack.substring(i+filePath.length+1,i+filePath.length+20);
var m = /^(\d+):(\d+)/.exec(excerpt); var m = /^(\d+)/.exec(excerpt);
if (m) { if (m) {
node.err = err+" (line:"+m[1]+")"; node.err = err+" (line:"+m[1]+")";
} }