Skip to content

Commit 63d3b1a

Browse files
utam0kroboquat
authored andcommitted
registry-facade: Be able to see where the error is coming from
1 parent 77b9db5 commit 63d3b1a

File tree

1 file changed

+4
-3
lines changed
  • components/registry-facade/pkg/registry

1 file changed

+4
-3
lines changed

components/registry-facade/pkg/registry/blob.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/opencontainers/go-digest"
2424
ociv1 "github.com/opencontainers/image-spec/specs-go/v1"
2525
"github.com/opentracing/opentracing-go"
26+
"golang.org/x/xerrors"
2627

2728
"github.com/gitpod-io/gitpod/common-go/log"
2829
"github.com/gitpod-io/gitpod/common-go/tracing"
@@ -118,7 +119,7 @@ func (bh *blobHandler) getBlob(w http.ResponseWriter, r *http.Request) {
118119
// Only if the store fetch fails should we attetmpt to download it.
119120
manifest, fetcher, err := bh.downloadManifest(ctx, bh.Spec.BaseRef)
120121
if err != nil {
121-
return err
122+
return xerrors.Errorf("cannnot fetch the manifest: %w", err)
122123
}
123124

124125
var srcs []BlobSource
@@ -153,7 +154,7 @@ func (bh *blobHandler) getBlob(w http.ResponseWriter, r *http.Request) {
153154

154155
dontCache, mediaType, url, rc, err := src.GetBlob(ctx, bh.Spec, bh.Digest)
155156
if err != nil {
156-
return err
157+
return xerrors.Errorf("cannnot fetch the blob: %w", err)
157158
}
158159
if rc != nil {
159160
defer rc.Close()
@@ -174,7 +175,7 @@ func (bh *blobHandler) getBlob(w http.ResponseWriter, r *http.Request) {
174175
if err != nil {
175176
bh.Metrics.BlobDownloadCounter.WithLabelValues(src.Name(), "false").Inc()
176177
log.WithField("blobSource", src.Name()).WithField("baseRef", bh.Spec.BaseRef).WithError(err).Error("unable to return blob")
177-
return err
178+
return xerrors.Errorf("unable to return blob: %w", err)
178179
}
179180

180181
bh.Metrics.BlobDownloadSpeedHist.WithLabelValues(src.Name()).Observe(float64(n) / time.Since(t0).Seconds())

0 commit comments

Comments
 (0)