connectrpc / connect-go

The Go implementation of Connect: Protobuf RPC that works.
https://connectrpc.com
Apache License 2.0
2.76k stars 91 forks source link

Wrap errors with context cancellation codes #659

Closed emcfarlane closed 4 months ago

emcfarlane commented 6 months ago

This PR wraps errors with the appropriate connect code of Cancelled or DeadlineExceeded if the context error is not nil.

Improves error handling for some well known error cases that do not surface context.Cancelled errors. For example HTTP2 "client disconnect" string errors are now raised with a Cancelled code not an Unknown. This lets handlers check the error code for better handling and reporting of errors.

Fix for #645

emcfarlane commented 6 months ago

Edit: can't reproduce test flakes. Looks to be solid now.

chrispine commented 5 months ago

So what's the status of this PR now? Did you still want to merge it, or is it no longer needed?

emcfarlane commented 5 months ago

@chrispine I think this behaviour is still wanted to fix the issue linked. PR needs review.