Use error interfaces for content/metadata
These interfaces allow us to preserve both the checking of error "cause" as well as messages returned from the gRPC API so that the client gets full error reason instead of a default "metadata: not found" in the case of a missing image. Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
This commit is contained in:
@@ -31,7 +31,7 @@ func (p dockerPusher) Push(ctx context.Context, desc ocispec.Descriptor) (conten
|
||||
status, err := p.tracker.GetStatus(ref)
|
||||
if err == nil {
|
||||
if status.Offset == status.Total {
|
||||
return nil, content.ErrExists
|
||||
return nil, content.ErrExists("")
|
||||
}
|
||||
// TODO: Handle incomplete status
|
||||
} else if !content.IsNotFound(err) {
|
||||
@@ -72,7 +72,7 @@ func (p dockerPusher) Push(ctx context.Context, desc ocispec.Descriptor) (conten
|
||||
// TODO: Set updated time?
|
||||
},
|
||||
})
|
||||
return nil, content.ErrExists
|
||||
return nil, content.ErrExists("")
|
||||
}
|
||||
if resp.StatusCode != http.StatusNotFound {
|
||||
// TODO: log error
|
||||
|
||||
@@ -34,7 +34,7 @@ func (t *memoryStatusTracker) GetStatus(ref string) (Status, error) {
|
||||
defer t.m.Unlock()
|
||||
status, ok := t.statuses[ref]
|
||||
if !ok {
|
||||
return Status{}, content.ErrNotFound
|
||||
return Status{}, content.ErrNotFound("")
|
||||
}
|
||||
return status, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user