mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix Function error parsing for node 0.12 format
This commit is contained in:
parent
a7b68c18b5
commit
bac4beae03
@ -106,15 +106,27 @@ module.exports = function(RED) {
|
|||||||
this.status({fill:"yellow",shape:"dot",text:""+converted});
|
this.status({fill:"yellow",shape:"dot",text:""+converted});
|
||||||
}
|
}
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
var errorMessage = err.toString();
|
|
||||||
|
var line = 0;
|
||||||
|
var errorMessage;
|
||||||
var stack = err.stack.split(/\r?\n/);
|
var stack = err.stack.split(/\r?\n/);
|
||||||
if (stack.length > 0) {
|
if (stack.length > 0) {
|
||||||
var m = /at undefined:(\d+):(\d+)$/.exec(stack[1]);
|
while(line < stack.length && stack[line].indexOf("ReferenceError") !== 0) {
|
||||||
if (m) {
|
line++;
|
||||||
var line = Number(m[1])-1;
|
|
||||||
var cha = m[2];
|
|
||||||
errorMessage += " (line "+line+", col "+cha+")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (line < stack.length) {
|
||||||
|
errorMessage = stack[line];
|
||||||
|
var m = /:(\d+):(\d+)$/.exec(stack[line+1]);
|
||||||
|
if (m) {
|
||||||
|
var line = Number(m[1])-1;
|
||||||
|
var cha = m[2];
|
||||||
|
errorMessage += " (line "+line+", col "+cha+")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!errorMessage) {
|
||||||
|
errorMessage = err.toString();
|
||||||
}
|
}
|
||||||
this.error(errorMessage, msg);
|
this.error(errorMessage, msg);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user