-
-
Notifications
You must be signed in to change notification settings - Fork 351
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
Requesting throwing alternative to body() #273
Comments
It sounds good but I wouldn't want to break the existing API to make this change alone and don't think it's worth adding a 2nd new function to opt into this new behavior |
By this you mean that you include adding a case to the error enum as a breaking change? Maybe this can go on a wishlist for the next major semver, if ever one happens? |
I mean changing it to be throwing would require everyone to update their code I think no one is managing a wish list, this is all volunteer effort |
I suggest making it be non-breaking from that perspective, with the existing route still offered, and maybe have it call into the throwing version with a `try?`.On Aug 20, 2024, at 10:28, Alex Ehlke ***@***.***> wrote:
I mean changing it to be throwing would require everyone to update their code
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Hey sorry for late reply - I'm not sure I understand the last comment right now but if you submit a PR that does something like adding a new route instead of changing existing code to throwing, that's great and yes I think I get you now, reuse across the 2 is great. Thanks... |
The signature for
body()
is:It would improve ergonomics if there was a version of this that threw, e.g.:
This would allow for better ergonomics at call sites that propagate errors, while not really diminishing the ergonomics for sites that want to deal in optionals, as
try?
is always available.It wasn't immediately clear to me if
try document.select("body")
is an appropriate alternative for getting a throwing version of this.The text was updated successfully, but these errors were encountered: