github.com/mika/distribution@v2.2.2-0.20160108133430-a75790e3d8e0+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 // ErrTagUnknown is returned if the given tag is not known by the tag service 20 type ErrTagUnknown struct { 21 Tag string 22 } 23 24 func (err ErrTagUnknown) Error() string { 25 return fmt.Sprintf("unknown tag=%s", err.Tag) 26 } 27 28 // ErrRepositoryUnknown is returned if the named repository is not known by 29 // the registry. 30 type ErrRepositoryUnknown struct { 31 Name string 32 } 33 34 func (err ErrRepositoryUnknown) Error() string { 35 return fmt.Sprintf("unknown repository name=%s", err.Name) 36 } 37 38 // ErrRepositoryNameInvalid should be used to denote an invalid repository 39 // name. Reason may set, indicating the cause of invalidity. 40 type ErrRepositoryNameInvalid struct { 41 Name string 42 Reason error 43 } 44 45 func (err ErrRepositoryNameInvalid) Error() string { 46 return fmt.Sprintf("repository name %q invalid: %v", err.Name, err.Reason) 47 } 48 49 // ErrManifestUnknown is returned if the manifest is not known by the 50 // registry. 51 type ErrManifestUnknown struct { 52 Name string 53 Tag string 54 } 55 56 func (err ErrManifestUnknown) Error() string { 57 return fmt.Sprintf("unknown manifest name=%s tag=%s", err.Name, err.Tag) 58 } 59 60 // ErrManifestUnknownRevision is returned when a manifest cannot be found by 61 // revision within a repository. 62 type ErrManifestUnknownRevision struct { 63 Name string 64 Revision digest.Digest 65 } 66 67 func (err ErrManifestUnknownRevision) Error() string { 68 return fmt.Sprintf("unknown manifest name=%s revision=%s", err.Name, err.Revision) 69 } 70 71 // ErrManifestUnverified is returned when the registry is unable to verify 72 // the manifest. 73 type ErrManifestUnverified struct{} 74 75 func (ErrManifestUnverified) Error() string { 76 return fmt.Sprintf("unverified manifest") 77 } 78 79 // ErrManifestVerification provides a type to collect errors encountered 80 // during manifest verification. Currently, it accepts errors of all types, 81 // but it may be narrowed to those involving manifest verification. 82 type ErrManifestVerification []error 83 84 func (errs ErrManifestVerification) Error() string { 85 var parts []string 86 for _, err := range errs { 87 parts = append(parts, err.Error()) 88 } 89 90 return fmt.Sprintf("errors verifying manifest: %v", strings.Join(parts, ",")) 91 } 92 93 // ErrManifestBlobUnknown returned when a referenced blob cannot be found. 94 type ErrManifestBlobUnknown struct { 95 Digest digest.Digest 96 } 97 98 func (err ErrManifestBlobUnknown) Error() string { 99 return fmt.Sprintf("unknown blob %v on manifest", err.Digest) 100 } 101 102 // ErrManifestNameInvalid should be used to denote an invalid manifest 103 // name. Reason may set, indicating the cause of invalidity. 104 type ErrManifestNameInvalid struct { 105 Name string 106 Reason error 107 } 108 109 func (err ErrManifestNameInvalid) Error() string { 110 return fmt.Sprintf("manifest name %q invalid: %v", err.Name, err.Reason) 111 }