rbd: return GRPC error from GRPC method

GRPC methods should only return GRPC errors
if any error occurs.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2022-10-18 10:39:15 +02:00 committed by mergify[bot]
parent 302fead713
commit f12fa3ee56

View File

@ -761,13 +761,13 @@ func (rs *ReplicationServer) GetVolumeReplicationInfo(ctx context.Context,
if err != nil { if err != nil {
log.ErrorLog(ctx, err.Error()) log.ErrorLog(ctx, err.Error())
return nil, fmt.Errorf("failed to get remote status: %w", err) return nil, status.Errorf(codes.Internal, "failed to get remote status: %v", err)
} }
description := remoteStatus.Description description := remoteStatus.Description
lastSyncTime, err := getLastSyncTime(description) lastSyncTime, err := getLastSyncTime(description)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to get last sync time: %w", err) return nil, status.Errorf(codes.Internal, "failed to get last sync time: %v", err)
} }
resp := &replication.GetVolumeReplicationInfoResponse{ resp := &replication.GetVolumeReplicationInfoResponse{