mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 18:43:34 +00:00
rbd: use internal as default error code in getGRPCError()
This commit replaces codes.Unknown with codes.Internal as the default error code in getGRPCError(). Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
@ -776,14 +776,10 @@ func getGRPCError(err error) error {
|
||||
}
|
||||
|
||||
errorStatusMap := map[error]codes.Code{
|
||||
corerbd.ErrFetchingLocalState: codes.Internal,
|
||||
corerbd.ErrResyncImageFailed: codes.Internal,
|
||||
corerbd.ErrDisableImageMirroringFailed: codes.Internal,
|
||||
corerbd.ErrFetchingMirroringInfo: codes.Internal,
|
||||
corerbd.ErrInvalidArgument: codes.InvalidArgument,
|
||||
corerbd.ErrAborted: codes.Aborted,
|
||||
corerbd.ErrFailedPrecondition: codes.FailedPrecondition,
|
||||
corerbd.ErrUnavailable: codes.Unavailable,
|
||||
corerbd.ErrInvalidArgument: codes.InvalidArgument,
|
||||
corerbd.ErrAborted: codes.Aborted,
|
||||
corerbd.ErrFailedPrecondition: codes.FailedPrecondition,
|
||||
corerbd.ErrUnavailable: codes.Unavailable,
|
||||
}
|
||||
|
||||
for e, code := range errorStatusMap {
|
||||
@ -792,8 +788,8 @@ func getGRPCError(err error) error {
|
||||
}
|
||||
}
|
||||
|
||||
// Handle any other non nil error not listed in the map
|
||||
return status.Error(codes.Unknown, err.Error())
|
||||
// Handle any other non nil error not listed in the map as internal error
|
||||
return status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
|
||||
// GetVolumeReplicationInfo extracts the RBD volume information from the volumeID, If the
|
||||
|
Reference in New Issue
Block a user