1
0
Fork 0
mirror of synced 2024-09-10 22:46:09 +12:00

account for objects in failure condition

This commit is contained in:
Peter Clement 2022-05-04 13:25:46 +01:00
parent 118b9bbd97
commit dea5e73317

View file

@ -144,6 +144,7 @@ class Orchestrator {
(loopStep.inputs.option === "String" && (loopStep.inputs.option === "String" &&
typeof newInput.binding !== "string") typeof newInput.binding !== "string")
) { ) {
console.log("hello")
this.updateContextAndOutput(loopStepNumber, step, tempOutput, { this.updateContextAndOutput(loopStepNumber, step, tempOutput, {
status: AutomationErrors.INCORRECT_TYPE, status: AutomationErrors.INCORRECT_TYPE,
success: false, success: false,
@ -191,7 +192,6 @@ class Orchestrator {
} }
} }
} }
if ( if (
index === parseInt(env.AUTOMATION_MAX_ITERATIONS) || index === parseInt(env.AUTOMATION_MAX_ITERATIONS) ||
index === loopStep.inputs.iterations index === loopStep.inputs.iterations
@ -205,10 +205,26 @@ class Orchestrator {
break break
} }
let isFailure = false
if ( if (
this._context.steps[loopStepNumber]?.currentItem === typeof this._context.steps[loopStepNumber]?.currentItem === "object"
loopStep.inputs.failure
) { ) {
isFailure = Object.keys(
this._context.steps[loopStepNumber].currentItem
).some(value => {
return (
this._context.steps[loopStepNumber].currentItem[value] ===
loopStep.inputs.failure
)
})
} else {
isFailure =
this._context.steps[loopStepNumber]?.currentItem ===
loopStep.inputs.failure
}
console.log(isFailure)
if (isFailure) {
this.updateContextAndOutput(loopStepNumber, step, tempOutput, { this.updateContextAndOutput(loopStepNumber, step, tempOutput, {
status: AutomationErrors.FAILURE_CONDITION, status: AutomationErrors.FAILURE_CONDITION,
success: false, success: false,