> For the complete documentation index, see [llms.txt](https://chimu.gitbook.io/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chimu.gitbook.io/api/errors/event-handler.md).

# Event handler

## How catch api error

When axios interceptor catch error api fired [customEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent) with *'apiErrorEvent'* name.

{% hint style="info" %}
&#x20;Event value contains in .detail field.
{% endhint %}

### Example:

{% code title="Field error contains in JSON Api sceme or default response" %}

```javascript
window.addEventListener(
    'apiErrorEvent',
    evt => {
        console.log(evt.detail.errors);
    },
    false
);

```

{% endcode %}
