@@ -207,11 +207,11 @@ func CreateSnapshot(ctx context.Context, kind snapshots.Kind, key, parent string
207207 if parent != "" {
208208 spbkt = bkt .Bucket ([]byte (parent ))
209209 if spbkt == nil {
210- return errors .Wrap (errdefs .ErrNotFound , "missing parent bucket" )
210+ return errors .Wrapf (errdefs .ErrNotFound , "missing parent %q bucket" , parent )
211211 }
212212
213213 if readKind (spbkt ) != snapshots .KindCommitted {
214- return errors .Wrap (errdefs .ErrInvalidArgument , "parent is not committed snapshot" )
214+ return errors .Wrapf (errdefs .ErrInvalidArgument , "parent %q is not committed snapshot" , parent )
215215 }
216216 }
217217 sbkt , err := bkt .CreateBucket ([]byte (key ))
@@ -224,7 +224,7 @@ func CreateSnapshot(ctx context.Context, kind snapshots.Kind, key, parent string
224224
225225 id , err := bkt .NextSequence ()
226226 if err != nil {
227- return errors .Wrap (err , "unable to get identifier" )
227+ return errors .Wrapf (err , "unable to get identifier for snapshot %q" , key )
228228 }
229229
230230 t := time .Now ().UTC ()
@@ -245,12 +245,12 @@ func CreateSnapshot(ctx context.Context, kind snapshots.Kind, key, parent string
245245 // Store a backlink from the key to the parent. Store the snapshot name
246246 // as the value to allow following the backlink to the snapshot value.
247247 if err := pbkt .Put (parentKey (pid , id ), []byte (key )); err != nil {
248- return errors .Wrap (err , "failed to write parent link" )
248+ return errors .Wrapf (err , "failed to write parent link for snapshot %q" , key )
249249 }
250250
251251 s .ParentIDs , err = parents (bkt , spbkt , pid )
252252 if err != nil {
253- return errors .Wrap (err , "failed to get parent chain" )
253+ return errors .Wrapf (err , "failed to get parent chain for snapshot %q" , key )
254254 }
255255 }
256256
@@ -438,7 +438,7 @@ func createBucketIfNotExists(ctx context.Context, fn func(context.Context, *bolt
438438 }
439439 pbkt , err := bkt .CreateBucketIfNotExists (bucketKeyParents )
440440 if err != nil {
441- return errors .Wrap (err , "failed to create snapshots bucket" )
441+ return errors .Wrap (err , "failed to create parents bucket" )
442442 }
443443 return fn (ctx , sbkt , pbkt )
444444}
0 commit comments