1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Ensure runtime errors in Change node can be caught

Fixes #1769
This commit is contained in:
Nick O'Leary 2018-06-29 11:49:39 +01:00
parent 781fa4634b
commit 14882bda78
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -123,7 +123,7 @@ module.exports = function(RED) {
try{ try{
value = RED.util.evaluateJSONataExpression(rule.to,msg); value = RED.util.evaluateJSONataExpression(rule.to,msg);
} catch(err) { } catch(err) {
node.error(RED._("change.errors.invalid-expr",{error:err.message})); node.error(RED._("change.errors.invalid-expr",{error:err.message}),msg);
return; return;
} }
} }
@ -150,11 +150,11 @@ module.exports = function(RED) {
fromRE = new RegExp(fromRE, "g"); fromRE = new RegExp(fromRE, "g");
} catch (e) { } catch (e) {
valid = false; valid = false;
node.error(RED._("change.errors.invalid-from",{error:e.message})); node.error(RED._("change.errors.invalid-from",{error:e.message}),msg);
return; return;
} }
} else { } else {
node.error(RED._("change.errors.invalid-from",{error:"unsupported type: "+(typeof fromValue)})); node.error(RED._("change.errors.invalid-from",{error:"unsupported type: "+(typeof fromValue)}),msg);
return return
} }
} else { } else {