Skip to Content

Workflow.then()

.then() メソッドは、ワークフローステップ間に順次依存関係を作成し、ステップが特定の順序で実行されることを保証します。

使用法

workflow.step(stepOne).then(stepTwo).then(stepThree);

パラメーター

step:

Step | string
前のステップが完了した後に実行されるべきステップインスタンスまたはステップID

戻り値

workflow:

Workflow
メソッドチェーンのためのワークフローインスタンス

検証

thenを使用する場合:

  • 前のステップはワークフローに存在しなければなりません
  • ステップは循環依存を形成することはできません
  • 各ステップは連続したチェーンに一度だけ現れることができます

エラーハンドリング

try { workflow .step(stepA) .then(stepB) .then(stepA) // Will throw error - circular dependency .commit(); } catch (error) { if (error instanceof ValidationError) { console.log(error.type); // 'circular_dependency' console.log(error.details); } }

関連項目