Change some compression related error code
This commit is contained in:
@ -285,13 +285,13 @@ func checkRecvPayload(pf payloadFormat, recvCompress string, dc Decompressor) er
|
||||
case compressionNone:
|
||||
case compressionMade:
|
||||
if recvCompress == "" {
|
||||
return transport.StreamErrorf(codes.InvalidArgument, "grpc: invalid grpc-encoding %q with compression enabled", recvCompress)
|
||||
return transport.StreamErrorf(codes.Internal, "grpc: invalid grpc-encoding with compression enabled")
|
||||
}
|
||||
if dc == nil || recvCompress != dc.Type() {
|
||||
return transport.StreamErrorf(codes.InvalidArgument, "grpc: Decompressor is not installed for grpc-encoding %q", recvCompress)
|
||||
return transport.StreamErrorf(codes.Unimplemented, "grpc: Decompressor is not installed for grpc-encoding %q", recvCompress)
|
||||
}
|
||||
default:
|
||||
return transport.StreamErrorf(codes.InvalidArgument, "grpc: received unexpected payload format %d", pf)
|
||||
return transport.StreamErrorf(codes.Internal, "grpc: received unexpected payload format %d", pf)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -1621,8 +1621,8 @@ func testCompressServerHasNoSupport(t *testing.T, e env) {
|
||||
ResponseSize: proto.Int32(respSize),
|
||||
Payload: payload,
|
||||
}
|
||||
if _, err := tc.UnaryCall(context.Background(), req); err == nil || grpc.Code(err) != codes.InvalidArgument {
|
||||
t.Fatalf("TestService/UnaryCall(_, _) = _, %v, want _, error code %d", err, codes.InvalidArgument)
|
||||
if _, err := tc.UnaryCall(context.Background(), req); err == nil || grpc.Code(err) != codes.Unimplemented {
|
||||
t.Fatalf("TestService/UnaryCall(_, _) = _, %v, want _, error code %d", err, codes.Unimplemented)
|
||||
}
|
||||
// Streaming RPC
|
||||
stream, err := tc.FullDuplexCall(context.Background())
|
||||
@ -1646,8 +1646,8 @@ func testCompressServerHasNoSupport(t *testing.T, e env) {
|
||||
if err := stream.Send(sreq); err != nil {
|
||||
t.Fatalf("%v.Send(%v) = %v, want <nil>", stream, sreq, err)
|
||||
}
|
||||
if _, err := stream.Recv(); err == nil || grpc.Code(err) != codes.InvalidArgument {
|
||||
t.Fatalf("%v.Recv() = %v, want error code %d", stream, err, codes.InvalidArgument)
|
||||
if _, err := stream.Recv(); err == nil || grpc.Code(err) != codes.Unimplemented {
|
||||
t.Fatalf("%v.Recv() = %v, want error code %d", stream, err, codes.Unimplemented)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user