mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Merge branch 'pr_1700'
This commit is contained in:
		@@ -204,7 +204,12 @@ module.exports = function(RED) {
 | 
			
		||||
        }
 | 
			
		||||
        var context = vm.createContext(sandbox);
 | 
			
		||||
        try {
 | 
			
		||||
            this.script = vm.createScript(functionText);
 | 
			
		||||
            this.script = vm.createScript(functionText, {
 | 
			
		||||
                filename: 'Function: '+this.id+(this.name?' ['+this.name+']':''), // filename for stack traces
 | 
			
		||||
                lineOffset: -11, // line number offset to be used for stack traces
 | 
			
		||||
                columnOffset: 0, // column number offset to be used for stack traces
 | 
			
		||||
                displayErrors: true
 | 
			
		||||
            });
 | 
			
		||||
            this.on("input", function(msg) {
 | 
			
		||||
                try {
 | 
			
		||||
                    var start = process.hrtime();
 | 
			
		||||
@@ -219,6 +224,13 @@ module.exports = function(RED) {
 | 
			
		||||
                        this.status({fill:"yellow",shape:"dot",text:""+converted});
 | 
			
		||||
                    }
 | 
			
		||||
                } catch(err) {
 | 
			
		||||
                    //remove unwanted part 
 | 
			
		||||
                    var index = err.stack.search(/\n\s*at ContextifyScript.Script.runInContext/);
 | 
			
		||||
                    err.stack = err.stack.slice(0, index).split('\n').slice(0,-1).join('\n');
 | 
			
		||||
                    var stack = err.stack.split(/\r?\n/);
 | 
			
		||||
 | 
			
		||||
                    //store the error in msg to be used in flows
 | 
			
		||||
                    msg.error = err;
 | 
			
		||||
                    
 | 
			
		||||
                    var line = 0;
 | 
			
		||||
                    var errorMessage;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user