connectrpc / connect-go

The Go implementation of Connect: Protobuf RPC that works.
https://connectrpc.com
Apache License 2.0
2.76k stars 90 forks source link

connect.CodeOf(nil) returns connect.CodeUnknown which is different to gRPC #718

Closed stan-stately closed 3 months ago

stan-stately commented 3 months ago

Describe the bug connect.CodeOf(nil) returns connect.CodeUnknown which is different to grpc which returns codes.OK

To Reproduce

You can repro with the following test:


func TestCodeOf(t *testing.T) {
    assert.Equal(t, connect.CodeOf(nil), connect.CodeUnknown)
    assert.Equal(t, status.Code(nil), codes.OK)
}

Additional context

jhump commented 3 months ago

Connect has no OK code. This is intentional since the code is only used to classify errors. Checking if the error is nil or not is the way to determine if an operation was okay.

This is not intended to be used in exactly the same fashion as grpc-go's API. We can clarify this further in the doc comments for connect.CodeOf.

stan-stately commented 3 months ago

thankyou