ZPT-JS tutorial - Managing errors

Errors happen. ZPT-JS manages errors using data-on-error attribute. Let's see an example:

sample.html
<p data-on-error="'Oh, noooo!'">
    ...
</p>
                

If an error occurs inside the p tag the full tag is replaced by the Oh, noooo string.

The data-on-error attribute supports any type of expression, so you can use for example a function expression to invoke a function to treat the error:

<p data-on-error="errorManager()">
    ...
</p>