github.com/samsalisbury/distribution@v2.2.1-0.20151123021722-54f974340220+incompatible/errors.go (about) 1 package distribution 2 3 import ( 4 "errors" 5 "fmt" 6 "strings" 7 8 "github.com/docker/distribution/digest" 9 ) 10 11 // ErrManifestNotModified is returned when a conditional manifest GetByTag 12 // returns nil due to the client indicating it has the latest version 13 var ErrManifestNotModified = errors.New("manifest not modified") 14 15 // ErrUnsupported is returned when an unimplemented or unsupported action is 16 // performed 17 var ErrUnsupported = errors.New("operation unsupported") 18 19 // ErrRepositoryUnknown is returned if the named repository is not known by 20 // the registry. 21 type ErrRepositoryUnknown struct { 22 Name string 23 } 24 25 func (err ErrRepositoryUnknown) Error() string { 26 return fmt.Sprintf("unknown repository name=%s", err.Name) 27 } 28 29 // ErrRepositoryNameInvalid should be used to denote an invalid repository 30 // name. Reason may set, indicating the cause of invalidity. 31 type ErrRepositoryNameInvalid struct { 32 Name string 33 Reason error 34 } 35 36 func (err ErrRepositoryNameInvalid) Error() string { 37 return fmt.Sprintf("repository name %q invalid: %v", err.Name, err.Reason) 38 } 39 40 // ErrManifestUnknown is returned if the manifest is not known by the 41 // registry. 42 type ErrManifestUnknown struct { 43 Name string 44 Tag string 45 } 46 47 func (err ErrManifestUnknown) Error() string { 48 return fmt.Sprintf("unknown manifest name=%s tag=%s", err.Name, err.Tag) 49 } 50 51 // ErrManifestUnknownRevision is returned when a manifest cannot be found by 52 // revision within a repository. 53 type ErrManifestUnknownRevision struct { 54 Name string 55 Revision digest.Digest 56 } 57 58 func (err ErrManifestUnknownRevision) Error() string { 59 return fmt.Sprintf("unknown manifest name=%s revision=%s", err.Name, err.Revision) 60 } 61 62 // ErrManifestUnverified is returned when the registry is unable to verify 63 // the manifest. 64 type ErrManifestUnverified struct{} 65 66 func (ErrManifestUnverified) Error() string { 67 return fmt.Sprintf("unverified manifest") 68 } 69 70 // ErrManifestVerification provides a type to collect errors encountered 71 // during manifest verification. Currently, it accepts errors of all types, 72 // but it may be narrowed to those involving manifest verification. 73 type ErrManifestVerification []error 74 75 func (errs ErrManifestVerification) Error() string { 76 var parts []string 77 for _, err := range errs { 78 parts = append(parts, err.Error()) 79 } 80 81 return fmt.Sprintf("errors verifying manifest: %v", strings.Join(parts, ",")) 82 } 83 84 // ErrManifestBlobUnknown returned when a referenced blob cannot be found. 85 type ErrManifestBlobUnknown struct { 86 Digest digest.Digest 87 } 88 89 func (err ErrManifestBlobUnknown) Error() string { 90 return fmt.Sprintf("unknown blob %v on manifest", err.Digest) 91 }