-
Notifications
You must be signed in to change notification settings - Fork 28
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
Handling/forwarding error-context
s that can be generated during a body.finish
#153
Comments
error-context
s that can be forwarded during a body.finish
error-context
s that can be generated during a body.finish
Great question! In the medium term (in some 0.3.x release), one idea @sunfishcode had that I really like is that In the short term, maybe it's fine to simply let the |
Thanks for the feedback @lukewagner ! The idea of One thing that makes me hesitate about that is the possible difficulty of intuiting that an
Yeah definitely want to hear what others think here. There are so many ways to go about this. Another thing that I forgot to mention that @dicej brought up is that we could actually not preemptively fetch the trailers for people and return them to the users to decide what to do with. We're at such a low level that I think that this might be really compelling as well. |
After chatting with @pchickey , the idea of allowing the caller to decide whether they want to listen for trailers seems to be the best option -- i.e. not pulling trailers inside the Any thoughts @lukewagner ? I neglected to mention this suggestion in the first comment. |
@vados-cosmonic That sounds like a reasonable alternative interface, esp. if it obviates the root issue. |
OK, got something up that implements this -- while I was going, I realized that the only case that seems reasonable for returning an WIT change: Upstream impl: |
During some implementation for
error-context
s infuture
s in the wasip3-prototyping repo, we found that there was an issue withwasi:http/types#body.finish
, as it implicitly does afuture.read
which can return a value or anerror-context
in the case of an error.There are a few ways that we can solve this (thanks to @rvolosatovs and @dicej for suggestions), but a short incomplete list follows:
finish
method signature fromresult<option<trailers>, error-code>
toresult<option<result<trailers, error-context>>,error-code>
error-code
(likelyinternal-error
)error-code
variant that stores anerror-context
(1) is a reasonable approach but pollutes the type and possibly unreasonably forces caller to handle the
error-context
directly.(2) causes some loss of context in an almost certain future version of
error-context
-- the best example is of an error context that can hold multiple traces (similar to ananyhow::Error
), if we were to boil down the error context into only astring
(given the current variants forerror-code
)(3) Seems like an ideal option as a variation of (2) -- an additional error variant like
internal-error-context(error-context)
which wouldThere are of course other ways to handle this, so I'd like to open this up to discussion before submitting a PR to make the change (going for #3)
The text was updated successfully, but these errors were encountered: