- はじめに
- 開発
- HTTP 要求
- コネクタ ノードの動作の仕組み
- コネクションを作成する
- 営業および顧客関係
- カスタマーサポートとヘルプデスク
- メッセージングと会議
- メール
- マーケティング
- ソーシャル メディア
- ファイル、ドキュメント、電子署名
- プロジェクト、コラボレーション、コード
- 人材と採用
- 金融とコマース
- AI モデルとエージェント
- 音声、視覚、言語
- データと場所
- クラウド、ID、セキュリティ
- デプロイして実行する
- 例
- 参照
エラーを処理する
Route failed nodes to an error path, return the error details, retry temporary failures, and end the workflow cleanly on unrecoverable errors.
構築するもの
A workflow that routes a failing node to a separate path, records the failure with useful context, retries temporary failures where that makes sense, and ends cleanly when the error is unrecoverable. The result is a pattern that fits into any existing workflow.
開始する前に
- 失敗する可能性のあるノードが少なくとも 1 つあり、[ エラー処理 ] タブがある既存のワークフロー (HTTP 要求ノードや抽出ノードなど)。
使用されるノード
- HTTP 要求: この例で失敗する可能性があるノードです。
- Script: returns the error details.
- 強制終了: 回復不能なエラーが発生した場合にワークフローを終了します。
手順
コーディング エージェントが設定されていれば、手動の手順を省略できます。質問してください:
Add error handling to the HTTP Request node in this Maestro Automate workflow: connect its error path to a Script node that returns the error message, retry temporary failures, and end the run with a Terminate node when the error can't be recovered.
Add error handling to the HTTP Request node in this Maestro Automate workflow: connect its error path to a Script node that returns the error message, retry temporary failures, and end the run with a Terminate node when the error can't be recovered.
次に、キャンバス上でワークフローを開き、以下の手順と照合してテストします。コーディング エージェントを設定する 設定について説明しています。
1. ノードのエラーハンドルを接続する
既定では、ノードに障害が発生するとワークフロー全体が停止します。代わりに、この失敗を処理するには、以下の手順を実行します。
-
キャンバス上でワークフローを開き、失敗する可能性のあるノードを選択します。
-
[ エラー処理 ] タブを開き、[ エラー処理を有効化] をオンにします。メイン出力ハンドルの下に エラー ハンドルが表示されます 。
-
エラー ハンドルの + を選択し、「スクリプト」を検索して選択します。
これによりエラー パスが作成されます。ノードに障害が発生すると、実行はワークフローを停止するのではなく、このパスをたどります。エラー ハンドルのないノードはエラー処理をサポートしていません。エラー ハンドルが失敗すると、ワークフローが停止して [インシデント] タブに表示されます。
2. Return the error details
In the Script node on the error path, read the error object at $vars.<node>.error and return the details:
const error = $vars.httpRequest1.error;
return {
message: "Error raised: " + error.message,
code: error.code,
status: error.status
};
const error = $vars.httpRequest1.error;
return {
message: "Error raised: " + error.message,
code: error.code,
status: error.status
};
The Script node's output appears in the execution trace, so the error details are visible when you inspect the run. The error object is only populated on the error path. The Error handling page lists the full set of error fields.
3. 一時的なエラーをリトライする (任意)
ネットワークの中断やレート制限など、障害が一時的なものである可能性が高い場合は、あきらめる前にリトライするとよいでしょう。HTTP 要求ノードには、リトライが組み込まれています。[詳細設定] タブで [リトライ回数] を設定すると、エラー ハンドルがトリガーされるまでに要求が何度も再試行されます。最後の失敗のみがエラー パスにルーティングされます。
複数回安全に実行できる操作のみをリトライします。データの書き込みやメッセージの送信などの副作用があるノードを再試行すると、重複が作成される可能性があります。
4. 回復できない場合は終了する
エラー パスのスクリプト ノードの後に [強制終了 ] ノードを追加します。エラーの説明を返すには、ノードで [ 出力変数を追加 ] を選択し、エラーを含む値を指定します (例: $vars.httpRequest1.error.message)。
ワークフローは [強制終了] ノードで終了し、実行が [実行を監視] のリストに表示されます。
5. テストとデバッグ
エラー パスを意図的にトリガーするには、以下の手順を実行します。
- HTTP 要求ノードの URL を一時的に無効な値 (例:
https://this-will-fail.example.com) に設定します。 - キャンバスの下部のツールバーで [ デバッグを実行 ] (▶) を選択し、実行トレースがエラー パスをたどることを確認します。
- 正しい URL を復元します。
In the trace, select the Script node and check its output for the error message.
結果
The workflow routes failures to the error path, returns the error details, optionally retries temporary failures, and ends cleanly with a descriptive failure status. An invalid URL in the HTTP Request node confirms that the error path works.
このワークフローを拡張する
- 失敗時にアラートを送信する: エラー パスの [強制終了] ノードの前に、 Slack チャンネルに通知したり、 ServiceNow インシデントを作成したりするための HTTP 要求ノードまたはコネクタ ノードを追加します。
- 終了する代わりに続行する: ステップが重要でない場合は、エラー パスにフォールバック値を設定してもらい、終了せずにメイン パスに再結合します。
- Apply this pattern widely: the Error handling page describes more patterns, such as returning error details and continuing, fallback values, and escalation.
次のステップ
- ワークフローをデプロイする: ユーザーがいなくてもワークフローを実行します。
- ガイド: 構築するワークフローが増えます。
- コミュニティ: 構築したものを共有したり、他のビルダーに助けを求めたりします。