mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 10:53:34 +00:00
cleanup: use errors.As() for error type checks
Replaces some remaining old-style error type checks with errors.As() Signed-off-by: Sven Anderson <sven@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
310c36e319
commit
13f291dfc6
@ -155,7 +155,8 @@ func checkSnapCloneExists(ctx context.Context, parentVol *rbdVolume, rbdSnap *rb
|
||||
if errors.As(err, &einf) {
|
||||
err = parentVol.deleteSnapshot(ctx, rbdSnap)
|
||||
if err != nil {
|
||||
if _, ok := err.(ErrSnapNotFound); !ok {
|
||||
var esnf ErrSnapNotFound
|
||||
if !errors.As(err, &esnf) {
|
||||
klog.Errorf(util.Log(ctx, "failed to delete snapshot %s: %v"), rbdSnap, err)
|
||||
return false, err
|
||||
}
|
||||
@ -181,7 +182,8 @@ func checkSnapCloneExists(ctx context.Context, parentVol *rbdVolume, rbdSnap *rb
|
||||
|
||||
// check snapshot exists if not create it
|
||||
_, err = vol.getSnapInfo(rbdSnap)
|
||||
if _, ok := err.(ErrSnapNotFound); ok {
|
||||
var esnf ErrSnapNotFound
|
||||
if errors.As(err, &esnf) {
|
||||
// create snapshot
|
||||
sErr := vol.createSnapshot(ctx, rbdSnap)
|
||||
if sErr != nil {
|
||||
|
Reference in New Issue
Block a user