frostfs-sdk-csharp/src/FrostFS.SDK.ClientV2/Mappers/Status.cs
Pavel Gross d1271df207 [#13] Client: Use code analyzers
Signed-off-by: Pavel Gross <p.gross@yadro.com>
2024-09-23 19:25:59 +03:00

18 lines
No EOL
575 B
C#

using System;
namespace FrostFS.SDK.ClientV2.Mappers.GRPC;
public static class StatusMapper
{
public static FrostFsResponseStatus ToModel(this Status.Status status)
{
if (status is null)
return new FrostFsResponseStatus(FrostFsStatusCode.Success);
var codeName = Enum.GetName(typeof(FrostFsStatusCode), status.Code);
return codeName is null
? throw new ArgumentException($"Unknown StatusCode. Value: '{status.Code}'.")
: new FrostFsResponseStatus((FrostFsStatusCode)status.Code, status.Message);
}
}