23 lines
1.0 KiB
C#
23 lines
1.0 KiB
C#
using FinalFactory.Rendezvous.Contracts;
|
|
|
|
namespace FinalFactory.Rendezvous.Server.State;
|
|
|
|
internal static class StoreResultMapping
|
|
{
|
|
public static RendezvousErrorCode ToContractError(this StoreResultCode code) => code switch
|
|
{
|
|
StoreResultCode.Success => RendezvousErrorCode.None,
|
|
StoreResultCode.NotFound => RendezvousErrorCode.NotFound,
|
|
StoreResultCode.Expired => RendezvousErrorCode.Expired,
|
|
StoreResultCode.Revoked => RendezvousErrorCode.Forbidden,
|
|
StoreResultCode.Conflict => RendezvousErrorCode.Conflict,
|
|
StoreResultCode.CapacityExceeded => RendezvousErrorCode.CapacityExceeded,
|
|
StoreResultCode.ReplayRejected => RendezvousErrorCode.ReplayRejected,
|
|
StoreResultCode.StaleHost => RendezvousErrorCode.StaleHost,
|
|
StoreResultCode.IncompatibleProtocol => RendezvousErrorCode.IncompatibleProtocol,
|
|
StoreResultCode.Draining or StoreResultCode.ServiceUnavailable =>
|
|
RendezvousErrorCode.ServiceUnavailable,
|
|
_ => RendezvousErrorCode.InternalError,
|
|
};
|
|
}
|