Skip to content

Commit

Permalink
rpc_util: Change error message to indicate size after decompression (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
uds5501 committed Nov 11, 2021
1 parent d61c7ae commit ea068ed
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions rpc_util.go
Expand Up @@ -712,13 +712,11 @@ func recvAndDecompress(p *parser, s *transport.Stream, dc Decompressor, maxRecei
if err != nil {
return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message %v", err)
}
} else {
size = len(d)
}
if size > maxReceiveMessageSize {
// TODO: Revisit the error code. Currently keep it consistent with java
// implementation.
return nil, status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max (%d vs. %d)", size, maxReceiveMessageSize)
if size > maxReceiveMessageSize {
// TODO: Revisit the error code. Currently keep it consistent with java
// implementation.
return nil, status.Errorf(codes.ResourceExhausted, "grpc: received message after decompression larger than max (%d vs. %d)", size, maxReceiveMessageSize)
}
}
return d, nil
}
Expand Down

0 comments on commit ea068ed

Please sign in to comment.