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) => {
|
getV1(node,msg,rule,state.hasParts, (err,value) => {
|
||||||
if (err) {
|
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);
|
return done(err);
|
||||||
}
|
}
|
||||||
v1 = value;
|
v1 = value;
|
||||||
getV2(node,msg,rule, (err,value) => {
|
getV2(node,msg,rule, (err,value) => {
|
||||||
if (err) {
|
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);
|
return done(err);
|
||||||
}
|
}
|
||||||
v2 = value;
|
v2 = value;
|
||||||
@ -189,16 +195,22 @@ module.exports = function(RED) {
|
|||||||
property = state.elseflag;
|
property = state.elseflag;
|
||||||
state.elseflag = true;
|
state.elseflag = true;
|
||||||
}
|
}
|
||||||
if (operators[rule.t](property,v1,v2,rule.case,msg.parts)) {
|
try {
|
||||||
state.onward.push(msg);
|
if (operators[rule.t](property,v1,v2,rule.case,msg.parts)) {
|
||||||
state.elseflag = false;
|
state.onward.push(msg);
|
||||||
if (node.checkall == "false") {
|
state.elseflag = false;
|
||||||
return done(undefined,false);
|
if (node.checkall == "false") {
|
||||||
|
return done(undefined,false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
state.onward.push(null);
|
||||||
}
|
}
|
||||||
} else {
|
done(undefined, state.currentRule < node.rules.length - 1);
|
||||||
state.onward.push(null);
|
} 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 {
|
} else {
|
||||||
applyRules(node,msg,property,undefined,(err,onward) => {
|
applyRules(node,msg,property,undefined,(err,onward) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
node.warn(err);
|
node.error(err, msg);
|
||||||
} else {
|
} else {
|
||||||
if (!repair || !hasParts) {
|
if (!repair || !hasParts) {
|
||||||
node.send(onward);
|
node.send(onward);
|
||||||
|
Loading…
Reference in New Issue
Block a user