Repository navigation
Conversation
Errors from out-of-process providers arrived without their errdefs class, so checks such as IsNotFound failed where they succeeded in process. Generated wiring now encodes the outermost supported class as a gRPC status code and restores the errdefs marker or context sentinel on the other side, including for stream errors. Decoded errors keep the original status, and their message no longer has the "rpc error: code = ... desc = ..." prefix. containerd's errgrpc is not used: its ToNative drops the gRPC status, and it sends Conflict() as codes.FailedPrecondition, recovered only by matching the message. Signed-off-by: Paweł Gronowski <git@grono.dev>
There was a problem hiding this comment.
🟡 Changes recommended
A non-comparable error that returns itself through As bypasses the progress guard, causing classCode to loop forever and leaving the generated RPC handler spinning.
1 open issue
4 files not reviewed
cmd/mobyextgen/wire.go: Generated fileexample/greeter/v0/protogen/wire.gen.go: Generated fileinternal/launcher/echo/v1/protogen/wire.gen.go: Generated filesdk/sdkapi/protogen/wire.gen.go: Generated file
What changed in this PR
This PR preserves supported error classes across gRPC so callers can classify out-of-process provider errors consistently with in-process errors.
Changes:
- Adds
grpcerrorconversions that map error classes to status codes and restore markers or context sentinels while retaining status information. - Updates generated unary and streaming adapters to apply these conversions.
- Adds conversion and runtime tests and documents the transport behavior.
| File | Description |
|---|---|
sdk/sdkapi/protogen/wire.gen.go |
Applies error conversion to SDK RPCs. |
internal/launcher/echo/v1/protogen/wire.gen.go |
Applies error conversion to Echo RPCs. |
grpcerror/grpcerror.go |
Implements error-class encoding and decoding. |
grpcerror/grpcerror_test.go |
Tests class mappings, precedence, and status preservation. |
example/greeter/v0/protogen/wire.gen.go |
Applies error conversion to Greeter RPCs. |
docs/DESIGN.md |
Documents error-class transport semantics. |
cmd/mobyextgen/wire.go |
Generates conversions for unary and streaming adapters. |
cmd/mobyextgen/testdata/runtime_behavior_test.go.txt |
Tests class restoration across RPC types and cancellation identity. |
Review effort: Balanced
| if v := reflect.ValueOf(cause); v.Comparable() && cause == err { | ||
| return nil |
|
Hm.. so, slightly wondering if we should still consider using github.com/containerd/errdefs (ToNative, or what's it?); would there be a risk for things getting out of sync, not aligning? Brief LLM summary;
|
|
We could do that, the differences in behavior are probably edgy and not that important. I don't think the fixes would be upstreamable. |

Errors from out-of-process providers arrived without their errdefs class, so checks such as IsNotFound failed where they succeeded in process.
Generated wiring now encodes the outermost supported class as a gRPC status code and restores the errdefs marker or context sentinel on the other side, including for stream errors. Decoded errors keep the original status, and their message no longer has the "rpc error: code = ... desc = ..." prefix.
containerd's errgrpc is not used: its ToNative drops the gRPC status, and it sends Conflict() as codes.FailedPrecondition, recovered only by matching the message.