mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
4cafe42cf4
commit
082bac8c3a
@ -177,11 +177,17 @@ module.exports = function(RED) {
|
||||
|
||||
getV1(node,msg,rule,state.hasParts, (err,value) => {
|
||||
if (err) {
|
||||
// This only happens if v1 is an invalid JSONata expr
|
||||
// But that will have already been logged and the node marked
|
||||
// invalid as part of the constructor
|
||||
return done(err);
|
||||
}
|
||||
v1 = value;
|
||||
getV2(node,msg,rule, (err,value) => {
|
||||
if (err) {
|
||||
// This only happens if v1 is an invalid JSONata expr
|
||||
// But that will have already been logged and the node marked
|
||||
// invalid as part of the constructor
|
||||
return done(err);
|
||||
}
|
||||
v2 = value;
|
||||
@ -189,6 +195,7 @@ module.exports = function(RED) {
|
||||
property = state.elseflag;
|
||||
state.elseflag = true;
|
||||
}
|
||||
try {
|
||||
if (operators[rule.t](property,v1,v2,rule.case,msg.parts)) {
|
||||
state.onward.push(msg);
|
||||
state.elseflag = false;
|
||||
@ -199,6 +206,11 @@ module.exports = function(RED) {
|
||||
state.onward.push(null);
|
||||
}
|
||||
done(undefined, state.currentRule < node.rules.length - 1);
|
||||
} catch(err) {
|
||||
// An error occurred evaluating the rule - for example, an
|
||||
// invalid RegExp value.
|
||||
done(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -437,7 +449,7 @@ module.exports = function(RED) {
|
||||
} else {
|
||||
applyRules(node,msg,property,undefined,(err,onward) => {
|
||||
if (err) {
|
||||
node.warn(err);
|
||||
node.error(err, msg);
|
||||
} else {
|
||||
if (!repair || !hasParts) {
|
||||
node.send(onward);
|
||||
|
Loading…
Reference in New Issue
Block a user