18 ms·
How does error handling work? If I try to replace the content of some div with a reply I get using htmx, but the request fails or times out etc., what content i
by m4lvin 4y ago
How does error handling work? If I try to replace the content of some div with a reply I get using htmx, but the request fails or times out etc., what content is then put into the div? What if the reply is not valid HTML?
Sorry for the newb and lazy questions.
- recursivedoubts 4y agohtmx doesn't do anything on an error by default, but you can override this behavior using the extensive event system it has: https://htmx.org/events/#htmx:responseError https://htmx.org/events/#htmx:responseError
- silver-arrow 4y agoIt’s pretty simple to use the htmx events on the Response to handle errors dialogs or other behavior