Why is the htmx:error event undocumented? #3456
KeithDickson
started this conversation in
General
Replies: 1 comment
-
|
Didn't get any responses to this inquiry. But for posterity, I ended up using an approach similar to the first suggestion in this related issue: I was already writing my own custom extension. So instead of handling the undocumented htmx:error event, I instead have my extension's onEvent method check for this condition and invoke my custom error handling method for any failed request: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm writing an error handler for htmx, and want to invoke a single handler for every kind of failure. Including 4xx/5xx response errors, timeouts, etc. I started by adding a separate listener for all of the many discrete error events implemented by htmx. Which is a little unwieldy.
But then I saw in the source code that it also triggers a generic htmx:error event for any error event. This is exactly what I need, and it seems to work fine in practice.
However, the htmx:error event is not documented. Is there any particular reason for that?
And is relying on this undocumented event discouraged, or is it considered a safe and stable feature?
Beta Was this translation helpful? Give feedback.
All reactions