2024-04-09 12:53:23 +02:00
|
|
|
|
namespace ShareeBike.Repository.Exception
|
2021-05-13 20:03:07 +02:00
|
|
|
|
{
|
2022-09-06 16:08:19 +02:00
|
|
|
|
public class InvalidResponseException<T> : InvalidResponseException
|
|
|
|
|
{
|
|
|
|
|
/// <summary> Constructs an invalid response Exception. </summary>
|
|
|
|
|
/// <param name="actionWhichFailed">Describes the action which failed.</param>
|
|
|
|
|
/// <param name="response">Response from copri.</param>
|
|
|
|
|
public InvalidResponseException(string actionWhichFailed, T response)
|
|
|
|
|
: base(string.Format(
|
|
|
|
|
"{0}{1}",
|
|
|
|
|
actionWhichFailed,
|
|
|
|
|
response == null ? string.Format(" Response of type {0} is null.", typeof(T).Name.ToString()) : string.Empty))
|
|
|
|
|
{
|
|
|
|
|
Response = response;
|
|
|
|
|
}
|
2021-05-13 20:03:07 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
public T Response { get; private set; }
|
|
|
|
|
}
|
2021-05-13 20:03:07 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Base exception for all generic invalid response exceptions.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class InvalidResponseException : CommunicationException
|
|
|
|
|
{
|
|
|
|
|
/// <summary> Prevents an invalid instance to be created. </summary>
|
|
|
|
|
private InvalidResponseException()
|
|
|
|
|
{ }
|
2021-05-13 20:03:07 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
/// <summary> Constructs a invalid response execption.</summary>
|
|
|
|
|
/// <param name="message">Exception.</param>
|
|
|
|
|
public InvalidResponseException(string message) : base(message)
|
|
|
|
|
{ }
|
|
|
|
|
}
|
2021-05-13 20:03:07 +02:00
|
|
|
|
}
|