sharee.bike-App/TINKLib/Repository/Exception/NoGPSDataException.cs
Anja Müller-Meißner 0468955d49 Version 3.0.338
2022-09-08 09:55:14 +02:00

27 lines
785 B
C#

namespace TINK.Repository.Exception
{
public class NoGPSDataException : InvalidResponseException
{
/// <summary> COPRI response status. </summary>
public const string RETURNBIKE_FAILURE_STATUS_MESSAGE_UPPERCASE = "FAILURE 2245: NO GPS DATA, STATE CHANGE FORBIDDEN.";
/// <summary> Prevents invalid use of exception. </summary>
private NoGPSDataException() : base(typeof(NoGPSDataException).Name)
{
}
public static bool IsNoGPSData(string responseState, out NoGPSDataException exception)
{
// Check if there are too many bikes requested/ booked.
if (!responseState.Trim().ToUpper().StartsWith(RETURNBIKE_FAILURE_STATUS_MESSAGE_UPPERCASE))
{
exception = null;
return false;
}
exception = new NoGPSDataException();
return true;
}
}
}