-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
http3: design a proper error API #3737
Comments
How would you do this in HTTP/2? |
It depends: general case: we currently use the exported values from https://github.com/golang/net/blob/master/http2/errors.go (for instance we use this to check for our specific context.WithTimeout case: the HTTP/2 client returns a
if HTTP/3 could return context errors that would be also nice to have but that is probably a separate issue from this one. Not all errors are context errors so it would be nice to have public "user friendly" values for http3 & quic errors. |
It's nice to have the http2 package as a precedent. I think it makes sense to expose a Returning a (wrapped?) context error in case of context expiration definitely makes sense. |
I've submitted PR #3744 (with my work account): a simple rename + make public. Having a |
Where does this error come from? Is this from |
yes among others. |
How do you get a context error then? You don't pass any context to |
i use a I built a small POC here: https://github.com/kgersen/h3ctx ( see the |
Related discussion: caddyserver/caddy#5766 (comment) |
@bt90 Can you elaborate? I'm not sure I understand what this means for the design of the error API here. |
I just saw that comment and thought it might be helpful. Feel free to ignore it if it isn't. |
We're using a
context.WithTimeout
for a HTTP/3 connection.In case of a timeout, we'd like to catch the
quic.StreamError
witherrorRequestCanceled
(errorCode = 0x10c)
.The
ErrorCode
field is exported but its possible values are not so we have to do a test with0x10c
(or duplicate http3/error_codes.go and cast)We could eventually test against the string representation
H3_REQUEST_CANCELLED
which is more user friendly than0x10c
buterrorCode
is not exported.May be I've missing something and there is a better way to test for an
errorRequestCanceled
than using 0x10c ?Our current error handling code :
The text was updated successfully, but these errors were encountered: