> For the complete documentation index, see [llms.txt](https://docs-embed.anyflow.jp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-embed.anyflow.jp/solution-editor/logic/error-monitoring.md).

# エラー監視

エラー監視は、「エラー監視」ステップの内側に追加したステップでエラーが発生した場合、「エラーならば」ステップの内側に処理が遷移します。

エラー監視ステップを追加するには、ソリューションエディタで「+」ボタンをクリック、次に「エラー」をクリックして追加します。

&#x20;

<figure><img src="https://files.readme.io/8241bae-try-catch.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://files.readme.io/1cadf53-try-catch.png" alt="" width="563"><figcaption></figcaption></figure>

上記の図で説明すると、「エラー監視」ステップの内側の「レコードを作成」ステップでエラーが発生した場合、「エラーならば」の内側に配置してある「メールを送信」ステップが実行されます。

メインユースケースとしては、該当ステップがエラーになった際にエンドユーザーに対してメールを送信する、ベンダーに対してメールを送信する、ログを出力するなどが考えられます。

{% hint style="success" %}

### ヒント

「エラーならば」のステップに遷移するかの判定は、アクションの[自動的な再試行（リトライ）](/ops/solution-error/action-retry.md)がすべて失敗した後で行われます。
{% endhint %}

## **SaaS Error と Anyflow Error**

### **SaaS Error**

SaaSのAPI呼び出しを行った結果、正常でないレスポンスが返却された場合にはエラーメッセージ冒頭に「SaaS Error:」の文字列が表示されます。

このエラーは[API呼び出しを行うアクション](/solution-editor/actions/api-call.md)でのみ発生します。

以下の例は、Google Sheetsのアクションにて存在しないスプレッドシートIDが指定されたことによる、404エラーの表示です。

<figure><img src="/files/crrCNc8K4SEYddGfU4c0" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="/files/2x3yQFMicyY4FKGXazn7" alt="" width="563"><figcaption></figcaption></figure>

### **Anyflow Error**

SaaSのAPI呼び出しを行う以前に、入力フィールドの処理にエラーがある等の場合にはエラーメッセージ冒頭に「Anyflow Error:」の文字列が表示されます。

このエラーはすべてのアクションで発生する可能性があります。

以下の例は、Google SheetsのアクションにてスプレッドシートIDに不正なformulaが渡されたことによるエラー表示です。

<figure><img src="/files/mXONy71jAXCpSsSjSasq" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="/files/PmqxdUu9n97fBBa63RoI" alt="" width="563"><figcaption></figcaption></figure>

## **「エラーならば」で使用できる変数について**

エラーの詳細は、「エラーならば」の内側で変数として利用できます。

<figure><img src="https://files.readme.io/6c217a8-image.png" alt="ソリューションエディタの変数ウィンドウ"><figcaption><p>ソリューションエディタの変数ウィンドウ</p></figcaption></figure>

各変数の内容は以下のとおりです。

<table><thead><tr><th width="135.36328125">変数名</th><th>説明</th></tr></thead><tbody><tr><td>Error Type</td><td><p>エラーの種類を表す文字列です。基本的には<code>http</code> または <code>error</code> が入りますが、コネクタのアクションごとに個別に定義された文字列が入ることもあります。</p><p><code>http</code>：HTTP 通信が直接の原因で発生したエラーです。<br><code>error</code>：エラーの原因が特定できないか、 Error Type が定義されていないエラーです。<br>上記以外：コネクタのアクションごとに個別に定義されたエラーです。</p></td></tr><tr><td>Error Message</td><td>エラーの内容を表すメッセージです。</td></tr><tr><td>Status Code</td><td>error_type が <code>http</code> であるときのみ、エラーの原因となった HTTP レスポンスのステータスコードが入ります。それ以外の場合は <code>None</code> が入ります。</td></tr></tbody></table>

{% hint style="warning" %}
formulaのエラーや型のエラーなどは「エラーならば」の変数としては出力できません。
{% endhint %}

## **実行履歴に遷移するURL**

上記の例では、実行履歴の詳細を確認するためのURLを記載しています。

<figure><img src="https://files.readme.io/77708ceaf20e41e19e282ecf124f59eccbe9c29ce6f2c2e127a3b2bcd1beea16-image.png" alt="エラー時の通知設定" width="600"><figcaption><p>エラー時の通知設定</p></figcaption></figure>

<figure><img src="https://files.readme.io/caaafb4c4f52f1b635c5d677f67e9ae44ae49b478e8a1d149969e9068ec93bb2-image.png" alt="遷移先の詳細画面"><figcaption><p>遷移先の詳細画面</p></figcaption></figure>

実行履歴の詳細ページのURLは以下の形式です。

`https://embed.anyflow.jp/jobs/{実行履歴ID}`

「実行履歴ID」は**標準変数**に定義されており、エラー時以外でも利用することができます。

<figure><img src="https://files.readme.io/283726ffcd9979e0ea3e2b20a6f25d285687bc495a13be24d3438af0ad509947-image.png" alt="" width="563"><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs-embed.anyflow.jp/solution-editor/logic/error-monitoring.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
