> For the complete documentation index, see [llms.txt](https://inistate.gitbook.io/home/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://inistate.gitbook.io/home/advanced/integration/error-handling.md).

# 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 %}
