mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Extract line number if available from node load errors
This commit is contained in:
parent
939768eec0
commit
0643f149b7
@ -315,6 +315,18 @@ function loadNodeSet(node) {
|
|||||||
return loadPromise;
|
return loadPromise;
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
node.err = err;
|
node.err = err;
|
||||||
|
var stack = err.stack;
|
||||||
|
var message;
|
||||||
|
if (stack) {
|
||||||
|
var i = stack.indexOf(node.file);
|
||||||
|
if (i > -1) {
|
||||||
|
var excerpt = stack.substring(i+node.file.length+1,i+node.file.length+20);
|
||||||
|
var m = /^(\d+):(\d+)/.exec(excerpt);
|
||||||
|
if (m) {
|
||||||
|
node.err = err+" (line:"+m[1]+")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return when.resolve(node);
|
return when.resolve(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user