Update errdefs to 0.3.0
Uses the new github.com/containerd/errdefs/pkg module which is intended to hold less stable utility functions separately from the stable github.com/containerd/errdefs error types. Includes temporary update to hcsshim until a release is cut there Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
@@ -23,11 +23,13 @@ import (
|
||||
"io"
|
||||
|
||||
streamingapi "github.com/containerd/containerd/api/services/streaming/v1"
|
||||
"github.com/containerd/containerd/v2/core/streaming"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/containerd/errdefs/pkg/errgrpc"
|
||||
"github.com/containerd/ttrpc"
|
||||
"github.com/containerd/typeurl/v2"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/containerd/containerd/v2/core/streaming"
|
||||
)
|
||||
|
||||
// NewStreamCreator returns a new stream creator which can communicate over a GRPC
|
||||
@@ -84,7 +86,7 @@ func (sc *streamCreator) Create(ctx context.Context, id string) (streaming.Strea
|
||||
err = stream.Send(typeurl.MarshalProto(a))
|
||||
if err != nil {
|
||||
if !errors.Is(err, io.EOF) {
|
||||
err = errdefs.FromGRPC(err)
|
||||
err = errgrpc.ToNative(err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
@@ -92,7 +94,7 @@ func (sc *streamCreator) Create(ctx context.Context, id string) (streaming.Strea
|
||||
// Receive an ack that stream is init and ready
|
||||
if _, err = stream.Recv(); err != nil {
|
||||
if !errors.Is(err, io.EOF) {
|
||||
err = errdefs.FromGRPC(err)
|
||||
err = errgrpc.ToNative(err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
@@ -109,7 +111,7 @@ type clientStream struct {
|
||||
func (cs *clientStream) Send(a typeurl.Any) (err error) {
|
||||
err = cs.s.Send(typeurl.MarshalProto(a))
|
||||
if !errors.Is(err, io.EOF) {
|
||||
err = errdefs.FromGRPC(err)
|
||||
err = errgrpc.ToNative(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -117,7 +119,7 @@ func (cs *clientStream) Send(a typeurl.Any) (err error) {
|
||||
func (cs *clientStream) Recv() (a typeurl.Any, err error) {
|
||||
a, err = cs.s.Recv()
|
||||
if !errors.Is(err, io.EOF) {
|
||||
err = errdefs.FromGRPC(err)
|
||||
err = errgrpc.ToNative(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user