github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/registry/errors.go (about) 1 package registry // import "github.com/demonoid81/moby/registry" 2 3 import ( 4 "net/url" 5 6 "github.com/docker/distribution/registry/api/errcode" 7 "github.com/demonoid81/moby/errdefs" 8 ) 9 10 type notFoundError string 11 12 func (e notFoundError) Error() string { 13 return string(e) 14 } 15 16 func (notFoundError) NotFound() {} 17 18 func translateV2AuthError(err error) error { 19 switch e := err.(type) { 20 case *url.Error: 21 switch e2 := e.Err.(type) { 22 case errcode.Error: 23 switch e2.Code { 24 case errcode.ErrorCodeUnauthorized: 25 return errdefs.Unauthorized(err) 26 } 27 } 28 } 29 30 return err 31 }