buildkit icon indicating copy to clipboard operation
buildkit copied to clipboard

grpcerrors: adapt grpcerrors to support more enriched error structures

Open jsternberg opened this issue 1 year ago • 2 comments

The grpcerrors package has been updated to support more enriched error structures.

The serialization structure has been changed to capture the original structure of the error and to serialize and deserialize into that same structure. Wrapped errors should be maintained with the same structure for unwrapping.

Unwrap() []error is now supported so errors.Join and anything else that wraps multiple errors can now be used and are serialized/deserialized correctly.

More methods of determining the grpc code are now supported and they will respect error wrapping. The errors in github.com/containerd/errdefs are now also used for mapping error codes with more likely to appear in the future.

The marshaling will marshal both the new format and the old format in a way where a client that reads either will succeed. That makes this method compatible with old clients.

jsternberg avatar Jul 31 '24 20:07 jsternberg