Skip to content

Commit

Permalink
proxy: Uncapitalize all errors
Browse files Browse the repository at this point in the history
By Go convention.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Nov 16, 2021
1 parent e9535f8 commit 05a2ed4
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions cmd/skopeo/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,14 @@ func (h *proxyHandler) OpenImage(args []interface{}) (replyBuf, error) {
var ret replyBuf

if h.sysctx == nil {
return ret, fmt.Errorf("Must invoke Initialize")
return ret, fmt.Errorf("client error: must invoke Initialize")
}
if len(args) != 1 {
return ret, fmt.Errorf("invalid request, expecting one argument")
}
imageref, ok := args[0].(string)
if !ok {
return ret, fmt.Errorf("Expecting string imageref, not %T", args[0])
return ret, fmt.Errorf("expecting string imageref, not %T", args[0])
}

imgRef, err := alltransports.ParseImageName(imageref)
Expand Down Expand Up @@ -237,7 +237,7 @@ func (h *proxyHandler) CloseImage(args []interface{}) (replyBuf, error) {
var ret replyBuf

if h.sysctx == nil {
return ret, fmt.Errorf("Must invoke Initialize")
return ret, fmt.Errorf("client error: must invoke Initialize")
}
if len(args) != 1 {
return ret, fmt.Errorf("invalid request, expecting one argument")
Expand All @@ -255,7 +255,7 @@ func (h *proxyHandler) CloseImage(args []interface{}) (replyBuf, error) {
func parseImageID(v interface{}) (uint32, error) {
imgidf, ok := v.(float64)
if !ok {
return 0, fmt.Errorf("Expecting integer imageid, not %T", v)
return 0, fmt.Errorf("expecting integer imageid, not %T", v)
}
return uint32(imgidf), nil
}
Expand All @@ -264,10 +264,10 @@ func parseImageID(v interface{}) (uint32, error) {
func parseUint64(v interface{}) (uint64, error) {
f, ok := v.(float64)
if !ok {
return 0, fmt.Errorf("Expecting numeric, not %T", v)
return 0, fmt.Errorf("expecting numeric, not %T", v)
}
if f > maxJSONFloat {
return 0, fmt.Errorf("Out of range integer for numeric %f", f)
return 0, fmt.Errorf("out of range integer for numeric %f", f)
}
return uint64(f), nil
}
Expand All @@ -279,7 +279,7 @@ func (h *proxyHandler) parseImageFromID(v interface{}) (*openImage, error) {
}
imgref, ok := h.images[imgid]
if !ok {
return nil, fmt.Errorf("No image %v", imgid)
return nil, fmt.Errorf("no image %v", imgid)
}
return imgref, nil
}
Expand Down Expand Up @@ -368,7 +368,7 @@ func (h *proxyHandler) GetManifest(args []interface{}) (replyBuf, error) {
var ret replyBuf

if h.sysctx == nil {
return ret, fmt.Errorf("Must invoke Initialize")
return ret, fmt.Errorf("client error: must invoke Initialize")
}
if len(args) != 1 {
return ret, fmt.Errorf("invalid request, expecting one argument")
Expand Down Expand Up @@ -397,9 +397,9 @@ func (h *proxyHandler) GetManifest(args []interface{}) (replyBuf, error) {
break
// Explicitly reject e.g. docker schema 1 type with a "legacy" note
case manifest.DockerV2Schema1MediaType, manifest.DockerV2Schema1SignedMediaType:
return ret, fmt.Errorf("Unsupported legacy manifest MIME type: %s", manifestType)
return ret, fmt.Errorf("unsupported legacy manifest MIME type: %s", manifestType)
default:
return ret, fmt.Errorf("Unsupported manifest MIME type: %s", manifestType)
return ret, fmt.Errorf("unsupported manifest MIME type: %s", manifestType)
}

// We always return the original digest, as that's what clients need to do pull-by-digest
Expand Down Expand Up @@ -438,7 +438,7 @@ func (h *proxyHandler) GetConfig(args []interface{}) (replyBuf, error) {
var ret replyBuf

if h.sysctx == nil {
return ret, fmt.Errorf("Must invoke Initialize")
return ret, fmt.Errorf("client error: must invoke Initialize")
}
if len(args) != 1 {
return ret, fmt.Errorf("invalid request, expecting: [imgid]")
Expand Down Expand Up @@ -474,7 +474,7 @@ func (h *proxyHandler) GetBlob(args []interface{}) (replyBuf, error) {
var ret replyBuf

if h.sysctx == nil {
return ret, fmt.Errorf("Must invoke Initialize")
return ret, fmt.Errorf("client error: must invoke Initialize")
}
if len(args) != 3 {
return ret, fmt.Errorf("found %d args, expecting (imgid, digest, size)", len(args))
Expand Down Expand Up @@ -517,7 +517,7 @@ func (h *proxyHandler) GetBlob(args []interface{}) (replyBuf, error) {
return
}
if n != int64(size) {
f.err = fmt.Errorf("Expected %d bytes in blob, got %d", size, n)
f.err = fmt.Errorf("expected %d bytes in blob, got %d", size, n)
}
if !verifier.Verified() {
f.err = fmt.Errorf("corrupted blob, expecting %s", d.String())
Expand Down

0 comments on commit 05a2ed4

Please sign in to comment.