Skip to content

statushandler: Don't lose original error when converting error codes

When observing context errors, then the statushandler middlerware converts the error code to either be context.DeadlineExceeded or context.Canceled. This is done by using the "%v" verb, which will cause us to lose the original error. And if the original error was a structerr, then this can cause us to lose any error metadata attached to it.

Fix this using "%w" instead and explicitly overriding the gRPC error code via WithGRPCCode().

Merge request reports