This repository was archived by the owner on Feb 8, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 1+ package errors
2+
3+ // This file contains all of the errors that can be generated from the
4+ // docker/image component.
5+
6+ import (
7+ "net/http"
8+
9+ "github.com/docker/distribution/registry/api/errcode"
10+ )
11+
12+ var (
13+ // ErrorCodeInvalidImageID is generated when image id specified is incorrectly formatted.
14+ ErrorCodeInvalidImageID = errcode .Register (errGroup , errcode.ErrorDescriptor {
15+ Value : "INVALIDIMAGEID" ,
16+ Message : "image ID '%s' is invalid " ,
17+ Description : "The specified image id is incorrectly formatted" ,
18+ HTTPStatusCode : http .StatusInternalServerError ,
19+ })
20+ )
Original file line number Diff line number Diff line change @@ -2,10 +2,10 @@ package image
22
33import (
44 "encoding/json"
5- "fmt"
65 "regexp"
76 "time"
87
8+ derr "github.com/docker/docker/errors"
99 "github.com/docker/docker/runconfig"
1010)
1111
@@ -53,7 +53,7 @@ func NewImgJSON(src []byte) (*Image, error) {
5353// ValidateID checks whether an ID string is a valid image ID.
5454func ValidateID (id string ) error {
5555 if ok := validHex .MatchString (id ); ! ok {
56- return fmt . Errorf ( "image ID '%s' is invalid" , id )
56+ return derr . ErrorCodeInvalidImageID . WithArgs ( id )
5757 }
5858 return nil
5959}
You can’t perform that action at this time.
0 commit comments