fix error stack

This commit is contained in:
Martin Guillon 2018-04-17 15:46:09 +02:00 committed by GitHub
parent 20f03c356c
commit 5967f4b0d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -224,7 +224,15 @@ module.exports = function(RED) {
this.status({fill:"yellow",shape:"dot",text:""+converted});
}
} catch(err) {
//remove unwanted part
const index = err.stack.search(/\n\s*at ContextifyScript.Script.runInContext/);
err.stack = err.stack.slice(0, index).split('\n').slice(0,-1).join('\n');
console.log(index, err.stack);
const stack = err.stack.split(/\r?\n/);
//store the error in msg to be used in flows
msg.error = err;
var line = 0;
var errorMessage;
var stack = err.stack.split(/\r?\n/);