Merge pull request #1766 from dnephin/fix-error-message
Normalize 'already exists' errors
This commit is contained in:
commit
96d2c1e0c2
@ -105,7 +105,7 @@ func (s *containerStore) Create(ctx context.Context, container containers.Contai
|
|||||||
cbkt, err := bkt.CreateBucket([]byte(container.ID))
|
cbkt, err := bkt.CreateBucket([]byte(container.ID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == bolt.ErrBucketExists {
|
if err == bolt.ErrBucketExists {
|
||||||
err = errors.Wrapf(errdefs.ErrAlreadyExists, "content %q", container.ID)
|
err = errors.Wrapf(errdefs.ErrAlreadyExists, "container %q", container.ID)
|
||||||
}
|
}
|
||||||
return containers.Container{}, err
|
return containers.Container{}, err
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ func (lm *LeaseManager) Create(ctx context.Context, lid string, labels map[strin
|
|||||||
if err == bolt.ErrBucketExists {
|
if err == bolt.ErrBucketExists {
|
||||||
err = errdefs.ErrAlreadyExists
|
err = errdefs.ErrAlreadyExists
|
||||||
}
|
}
|
||||||
return Lease{}, err
|
return Lease{}, errors.Wrapf(err, "lease %q", lid)
|
||||||
}
|
}
|
||||||
|
|
||||||
t := time.Now().UTC()
|
t := time.Now().UTC()
|
||||||
|
@ -284,7 +284,7 @@ func (s *snapshotter) createSnapshot(ctx context.Context, key, parent string, re
|
|||||||
bbkt, err := bkt.CreateBucket([]byte(key))
|
bbkt, err := bkt.CreateBucket([]byte(key))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == bolt.ErrBucketExists {
|
if err == bolt.ErrBucketExists {
|
||||||
err = errors.Wrapf(errdefs.ErrAlreadyExists, "snapshot %v already exists", key)
|
err = errors.Wrapf(errdefs.ErrAlreadyExists, "snapshot %q", key)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -373,7 +373,7 @@ func (s *snapshotter) Commit(ctx context.Context, name, key string, opts ...snap
|
|||||||
bbkt, err := bkt.CreateBucket([]byte(name))
|
bbkt, err := bkt.CreateBucket([]byte(name))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == bolt.ErrBucketExists {
|
if err == bolt.ErrBucketExists {
|
||||||
err = errors.Wrapf(errdefs.ErrAlreadyExists, "snapshot %v already exists", name)
|
err = errors.Wrapf(errdefs.ErrAlreadyExists, "snapshot %q", name)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ func (p dockerPusher) Push(ctx context.Context, desc ocispec.Descriptor) (conten
|
|||||||
status, err := p.tracker.GetStatus(ref)
|
status, err := p.tracker.GetStatus(ref)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if status.Offset == status.Total {
|
if status.Offset == status.Total {
|
||||||
return nil, errors.Wrapf(errdefs.ErrAlreadyExists, "ref %v already exists", ref)
|
return nil, errors.Wrapf(errdefs.ErrAlreadyExists, "ref %v", ref)
|
||||||
}
|
}
|
||||||
// TODO: Handle incomplete status
|
// TODO: Handle incomplete status
|
||||||
} else if !errdefs.IsNotFound(err) {
|
} else if !errdefs.IsNotFound(err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user