services/content: move service client into package
Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
parent
4793f968e5
commit
5da4e1d0d2
10 changed files with 136 additions and 102 deletions
19
services/content/helpers.go
Normal file
19
services/content/helpers.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package content
|
||||
|
||||
import (
|
||||
"github.com/docker/containerd/content"
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
)
|
||||
|
||||
func rewriteGRPCError(err error) error {
|
||||
switch grpc.Code(errors.Cause(err)) {
|
||||
case codes.AlreadyExists:
|
||||
return content.ErrExists
|
||||
case codes.NotFound:
|
||||
return content.ErrNotFound
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue