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

@ -89,16 +89,14 @@ func (ns *NodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol
volOptions, _, err := newVolumeOptionsFromVolID(ctx, string(volID), req.GetVolumeContext(), req.GetSecrets())
if err != nil {
var eivi ErrInvalidVolID
if !errors.As(err, &eivi) {
if !errors.Is(err, ErrInvalidVolID) {
return nil, status.Error(codes.Internal, err.Error())
}
// gets mon IPs from the supplied cluster info
volOptions, _, err = newVolumeOptionsFromStaticVolume(string(volID), req.GetVolumeContext())
if err != nil {
var ensv ErrNonStaticVolume
if !errors.As(err, &ensv) {
if !errors.Is(err, ErrNonStaticVolume) {
return nil, status.Error(codes.Internal, err.Error())
}