Skip to content

helper: Preserve status code of underlying error

Pavlo Strokov requested to merge ps-popup-code into master

The variations of the Err<StatusCode>() and Err<StatusCode>f() functions don't verify if the passed in error wraps gRPC error already on some nested level except the upper one only. That is why initially InvalidArgument code error could be returned with Internal code and wrapped inside the message, so it would look like there was another RPC method invocation.

The GrpcCode is refactored here as well, to follow the same approach. Now it unwraps the errors and looks for the initial status most deeply nested. If found it becomes the final for the RPC invocation and send to the caller.

Edited by Pavlo Strokov

Merge request reports