mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
rbd: simplify error handling
This change replaces the sentinel errors in rbd module with standard errors created with errors.New(). Related: #1203 Signed-off-by: Sven Anderson <sven@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
dba2c27bcb
commit
92884f56f4
@ -66,16 +66,14 @@ func createRBDClone(ctx context.Context, parentVol, cloneRbdVol *rbdVolume, snap
|
||||
func cleanUpSnapshot(ctx context.Context, parentVol *rbdVolume, rbdSnap *rbdSnapshot, rbdVol *rbdVolume, cr *util.Credentials) error {
|
||||
err := parentVol.deleteSnapshot(ctx, rbdSnap)
|
||||
if err != nil {
|
||||
var esnf ErrSnapNotFound
|
||||
if !errors.As(err, &esnf) {
|
||||
if !errors.Is(err, ErrSnapNotFound) {
|
||||
klog.Errorf(util.Log(ctx, "failed to delete snapshot: %v"), err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
err = deleteImage(ctx, rbdVol, cr)
|
||||
if err != nil {
|
||||
var einf ErrImageNotFound
|
||||
if !errors.As(err, &einf) {
|
||||
if !errors.Is(err, ErrImageNotFound) {
|
||||
klog.Errorf(util.Log(ctx, "failed to delete rbd image: %s/%s with error: %v"), rbdVol.Pool, rbdVol.VolName, err)
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user