@@ -22,13 +22,14 @@ import (
2222 "io"
2323
2424 containersapi "github.com/containerd/containerd/api/services/containers/v1"
25- "github.com/containerd/containerd/v2/core/containers"
26- "github.com/containerd/containerd/v2/pkg/protobuf"
27- ptypes "github.com/containerd/containerd/v2/pkg/protobuf/types"
28- "github.com/containerd/errdefs"
25+ "github.com/containerd/errdefs/pkg/errgrpc"
2926 "github.com/containerd/typeurl/v2"
3027 "google.golang.org/grpc/codes"
3128 "google.golang.org/grpc/status"
29+
30+ "github.com/containerd/containerd/v2/core/containers"
31+ "github.com/containerd/containerd/v2/pkg/protobuf"
32+ ptypes "github.com/containerd/containerd/v2/pkg/protobuf/types"
3233)
3334
3435type remoteContainers struct {
@@ -49,7 +50,7 @@ func (r *remoteContainers) Get(ctx context.Context, id string) (containers.Conta
4950 ID : id ,
5051 })
5152 if err != nil {
52- return containers.Container {}, errdefs . FromGRPC (err )
53+ return containers.Container {}, errgrpc . ToNative (err )
5354 }
5455
5556 return containerFromProto (resp .Container ), nil
@@ -71,7 +72,7 @@ func (r *remoteContainers) list(ctx context.Context, filters ...string) ([]conta
7172 Filters : filters ,
7273 })
7374 if err != nil {
74- return nil , errdefs . FromGRPC (err )
75+ return nil , errgrpc . ToNative (err )
7576 }
7677 return containersFromProto (resp .Containers ), nil
7778}
@@ -83,7 +84,7 @@ func (r *remoteContainers) stream(ctx context.Context, filters ...string) ([]con
8384 Filters : filters ,
8485 })
8586 if err != nil {
86- return nil , errdefs . FromGRPC (err )
87+ return nil , errgrpc . ToNative (err )
8788 }
8889 var containers []containers.Container
8990 for {
@@ -97,7 +98,7 @@ func (r *remoteContainers) stream(ctx context.Context, filters ...string) ([]con
9798 return nil , errStreamNotAvailable
9899 }
99100 }
100- return nil , errdefs . FromGRPC (err )
101+ return nil , errgrpc . ToNative (err )
101102 }
102103 select {
103104 case <- ctx .Done ():
@@ -113,7 +114,7 @@ func (r *remoteContainers) Create(ctx context.Context, container containers.Cont
113114 Container : containerToProto (& container ),
114115 })
115116 if err != nil {
116- return containers.Container {}, errdefs . FromGRPC (err )
117+ return containers.Container {}, errgrpc . ToNative (err )
117118 }
118119
119120 return containerFromProto (created .Container ), nil
@@ -133,7 +134,7 @@ func (r *remoteContainers) Update(ctx context.Context, container containers.Cont
133134 UpdateMask : updateMask ,
134135 })
135136 if err != nil {
136- return containers.Container {}, errdefs . FromGRPC (err )
137+ return containers.Container {}, errgrpc . ToNative (err )
137138 }
138139
139140 return containerFromProto (updated .Container ), nil
@@ -145,7 +146,7 @@ func (r *remoteContainers) Delete(ctx context.Context, id string) error {
145146 ID : id ,
146147 })
147148
148- return errdefs . FromGRPC (err )
149+ return errgrpc . ToNative (err )
149150
150151}
151152
0 commit comments