in components/base-workflow/packages/workflow-engine/lib/step/step-loop.js [124:157]
async tick() {
// we need to check if there were errors in pervious steps
// and if so, then we start the loop for this new step only and only if step.skippable = false
if (this.shouldSkip() && this.stateLabel === 'start') {
await this.safeFireEvent('stepLoopSkipped');
return this.passDecision();
}
return this.catchAndReport(async () => {
const { stateLabel } = this;
this.stepImplementation = undefined;
let decision;
switch (stateLabel) {
case 'start':
this.stepImplementation = await this.getStepImplementation();
await this.fireEvent('stepLoopStarted');
decision = await this.stepImplementation.start();
return this.processStepDecision(decision);
case 'wait':
case 'goto':
case 'pause':
case 'loop':
this.stepImplementation = await this.getStepImplementation();
return this.processDecisionQueue();
case 'pass':
throw new Error('Trying to run a step loop that has already passed.');
case 'fail':
throw new Error('Trying to run a step loop that has already failed.');
default:
throw new Error(`The step loop has an unsupported "${stateLabel}" state label.`);
}
});
}