fix difference between unitary and stream codec error handling

This commit is contained in:
Michal Witkowski
2015-10-01 17:37:17 +01:00
parent f3de7c238c
commit 1a7cf7f696

View File

@ -187,7 +187,11 @@ func recv(p *parser, c Codec, m interface{}) error {
switch pf { switch pf {
case compressionNone: case compressionNone:
if err := c.Unmarshal(d, m); err != nil { if err := c.Unmarshal(d, m); err != nil {
return Errorf(codes.Internal, "grpc: %v", err) if rErr, ok := err.(rpcError); ok {
return rErr
} else {
return Errorf(codes.Internal, "grpc: %v", err)
}
} }
default: default:
return Errorf(codes.Internal, "gprc: compression is not supported yet.") return Errorf(codes.Internal, "gprc: compression is not supported yet.")