diff options
| author | Murilo Ijanc <[email protected]> | 2026-07-26 12:42:38 -0300 |
|---|---|---|
| committer | Murilo Ijanc <[email protected]> | 2026-07-26 13:10:34 -0300 |
| commit | a2b10fd494fb389e556e40134031eb86e56e11e7 (patch) | |
| tree | 08b6df8a06f2c7c15488b90d57a6d8286cd57a22 /src/Cepis/ServerErrorException.cs | |
| download | csharp-a2b10fd494fb389e556e40134031eb86e56e11e7.tar.gz | |
Initial importv0.1.0
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; } +} |