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:
commit
5bbd3d6273
@ -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]+")";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user