# j-ErrorHandler

> This component captures the ON('ERROR', function(err event trigger from the ERROR() method and tries to display form more comfortably.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: d0eff3067a30ff275b0b6037ad8ad0c00145d6e3a7792849ada3138938f37047
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

This component captures the `ON('ERROR', function(err` event trigger from the `ERROR()` method and tries to display form more comfortably.

- singleton

__Configuration__:

- `keywords {String}` which will be searched in the error messages (default value: `401=login`)
	- must be in the form `search1=target_property,search2=target_property`
- `exec {String}` a link to the `function(response)`, output:
	- `response.items {String Array}`
	- `response.message {String}`
	- `response.keyword_target_property {Boolean}` optional, according to the `keywords` settings
- __NEW__: `offline {String}` an offline message, default: `No internet connection`

The component tries using `j-Message`, `j-Snackbar`, `j-NotifyBar` or `j-Notify` for displaying of errors if you don't have defined `exec` configuration.

Use it with `<ui-component name="errorhandler">`. When the component is not loaded yet, jComponent downloads it on first use from the address in `DEF.fallback` (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

```html example.html
<ui-component name="errorhandler"></ui-component>
<ui-component name="LAZY message"></ui-component>

<script>

	setTimeout(function() {
		ERROR([{ error: 'Error 1' }, { error: 'Error 2' }]);
	}, 3000);

</script>
```
