diff options
Diffstat (limited to 'src/Cepis/ServerErrorException.cs')
| -rw-r--r-- | src/Cepis/ServerErrorException.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Cepis/ServerErrorException.cs b/src/Cepis/ServerErrorException.cs new file mode 100644 index 0000000..82cea5e --- /dev/null +++ b/src/Cepis/ServerErrorException.cs @@ -0,0 +1,29 @@ +namespace Cepis; + +/// <summary> +/// The API answered 5xx on every attempt. +/// </summary> +public sealed class ServerErrorException : CepisException +{ + /// <summary>Create the exception with a message and the status seen.</summary> + /// <param name="message">what went wrong</param> + /// <param name="status">the HTTP status of the last attempt</param> + public ServerErrorException(string message, int status) + : base(message) + { + Status = status; + } + + /// <summary>Create the exception with a message, the status and a cause.</summary> + /// <param name="message">what went wrong</param> + /// <param name="status">the HTTP status of the last attempt</param> + /// <param name="innerException">the failure underneath</param> + public ServerErrorException(string message, int status, Exception? innerException) + : base(message, innerException) + { + Status = status; + } + + /// <summary>The HTTP status seen on the last attempt.</summary> + public int Status { get; } +} |