htmx/www/attributes/hx-error-url.md
2020-05-17 05:22:19 -07:00

571 B

layout title
layout.njk </> htmx - hx-error-url

hx-error-url

The hx-error-url attribute allows you to send client-side errors to a specified URL. It is typically put on the body tag, so all errors are caught and send to the server.

<body hx-error-url="/errors">\

</body>

When a client side error is caught by htmx it will be POST-ed to the given URL, with the following JSON format:

  { "elt": elt.id, "event": eventName, "detail" : detail }

Notes

  • hx-error-url is inherited and can be placed on a parent element