summaryrefslogtreecommitdiffstats
path: root/src/Cepis/ServerErrorException.cs
blob: 82cea5e423ecc474b78b785a9c5c4d6dd791958e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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; }
}