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,16 +195,22 @@ module.exports = function(RED) {
|
||||
property = state.elseflag;
|
||||
state.elseflag = true;
|
||||
}
|
||||
if (operators[rule.t](property,v1,v2,rule.case,msg.parts)) {
|
||||
state.onward.push(msg);
|
||||
state.elseflag = false;
|
||||
if (node.checkall == "false") {
|
||||
return done(undefined,false);
|
||||
try {
|
||||
if (operators[rule.t](property,v1,v2,rule.case,msg.parts)) {
|
||||
state.onward.push(msg);
|
||||
state.elseflag = false;
|
||||
if (node.checkall == "false") {
|
||||
return done(undefined,false);
|
||||
}
|
||||
} else {
|
||||
state.onward.push(null);
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
done(undefined, state.currentRule < node.rules.length - 1);
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -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