cephfs: simplify error handling

This change replaces the sentinel errors in cephfs module with
standard errors created with errors.New().

Related: #1203

Signed-off-by: Sven Anderson <sven@redhat.com>
This commit is contained in:
Sven Anderson
2020-07-10 02:14:39 +02:00
committed by mergify[bot]
parent 7c9c7c78a7
commit dba2c27bcb
6 changed files with 22 additions and 61 deletions

View File

@ -70,7 +70,7 @@ func getVolumeRootPathCeph(ctx context.Context, volOptions *volumeOptions, cr *u
klog.Errorf(util.Log(ctx, "failed to get the rootpath for the vol %s(%s) stdError %s"), string(volID), err, stdErrString)
if strings.HasPrefix(stdErrString, errNotFoundString) {
return "", ErrVolumeNotFound{err}
return "", util.JoinErrors(ErrVolumeNotFound, err)
}
return "", err
@ -215,7 +215,7 @@ func purgeVolume(ctx context.Context, volID volumeID, cr *util.Credentials, volO
klog.Errorf(util.Log(ctx, "failed to purge subvolume %s(%s) in fs %s"), string(volID), err, volOptions.FsName)
if strings.HasPrefix(err.Error(), errNotFoundString) {
return ErrVolumeNotFound{err}
return util.JoinErrors(ErrVolumeNotFound, err)
}
return err