# Error Handling

{% hint style="info" %}
Ensure module includes these field :

* `Error` field (Boolean)
* `Error Message` field (Text)
  {% endhint %}

## Error Handling Sample Code

{% tabs %}
{% tab title="SyncErrorHandle Script" %}
{% hint style="info" %}
To find `{fieldName}`, you are required to have access to **Alpha** or use **Network** in Developer Tools `[F12]`.
{% endhint %}

```python
moduleName = "{YOUR_MODULE_NAME}"
if inputs is not None and inputs['document'] is not None and inputs['document']['payload'] is not None:
    doc = Module(moduleName).find({ 'Dynamic.Extension.{fieldName}': inputs['document']['payload']['docNo'] })
    if doc is not None:
        form = Module(moduleName).execute('sync', doc)
        form['Error'] = True
        form['Error Message'] = inputs['error']
        debug("result",form)
        Module(moduleName).submit(doc, form)
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://inistate.gitbook.io/home/advanced/integration/error-handling.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
