cleanup: use errors.As() in rbd.NodeUnstageVolume()

See-also: https://github.com/golang/go/wiki/ErrorValueFAQ#how-should-i-change-my-error-handling-code-to-work-with-the-new-features
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-06-25 10:35:19 +02:00 committed by mergify[bot]
parent 7126e92b4f
commit d4dad7c189

View File

@ -18,6 +18,7 @@ package rbd
import (
"context"
"errors"
"fmt"
"os"
"strconv"
@ -675,7 +676,8 @@ func (ns *NodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstag
}
// If not mounted, and error is anything other than metadata file missing, it is an error
if _, ok := err.(ErrMissingStash); !ok {
var ems ErrMissingStash
if !errors.As(err, &ems) {
return nil, status.Error(codes.Internal, err.Error())
}