Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add extension swap-errors #626

Closed

Conversation

jgirardet
Copy link
Contributor

@jgirardet jgirardet commented Oct 20, 2021

the swap-errors extension allows swapping response when HTTP Error code is returned.
It's nice way to deal with errors server-side in
It works adding the header HX-SWAP-ERRORS in the response.

@1cg
Copy link
Contributor

1cg commented Nov 12, 2021

@jgirardet do you think that this extension has been obviated by the new support for configuring swap behavior in the htmx:beforeSwap event?

@jgirardet
Copy link
Contributor Author

No I don't. This extension allows you to write less javascript where htmx:beforeSwap forces to write more JavaScript.
Since many errors are handled server side, I think it's better for htmx to support the result (with a non 200 status code) out of the box.

src/ext/swap-errors.js Outdated Show resolved Hide resolved
@jgirardet jgirardet requested a review from 1cg February 28, 2022 09:18
@vrecan
Copy link

vrecan commented Jul 6, 2022

I agree, I think this would be extremely useful. It's sad to see that this never got merged.

@alexpetros
Copy link
Collaborator

This extension allows you to write less javascript where htmx:beforeSwap forces to write more JavaScript.
Since many errors are handled server side, I think it's better for htmx to support the result (with a non 200 status code) out of the box.

I agree with this, though coming up with a conceptual framework that allows configuration via attributes (instead of JS) is difficult!

We're working with this concept in #1620, so I'm going to close this PR in favor of that.

@alexpetros alexpetros closed this Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants