Return ErrNotFound when deleting a non-exist image.

Signed-off-by: Random-Liu <lantaol@google.com>
This commit is contained in:
Random-Liu 2017-05-18 15:49:39 -07:00
parent bbeaab5ee3
commit c163673ba3

View File

@ -134,7 +134,11 @@ func (s *storage) List(ctx context.Context) ([]Image, error) {
func (s *storage) Delete(ctx context.Context, name string) error {
return withImagesBucket(s.tx, func(bkt *bolt.Bucket) error {
return bkt.DeleteBucket([]byte(name))
err := bkt.DeleteBucket([]byte(name))
if err == bolt.ErrBucketNotFound {
return ErrNotFound
}
return err
})
}