namespace Cepis;
///
/// The API, or the edge in front of it, answered 429 on every attempt.
///
public sealed class RateLimitedException : CepisException
{
/// Create the exception with a message and the wait requested.
/// what went wrong
///
/// what the server asked for, or if it did not say
///
public RateLimitedException(string message, TimeSpan? retryAfter = null)
: base(message)
{
RetryAfter = retryAfter;
}
/// Create the exception with a message, the wait and a cause.
/// what went wrong
/// what the server asked for, if anything
/// the failure underneath
public RateLimitedException(string message, TimeSpan? retryAfter, Exception? innerException)
: base(message, innerException)
{
RetryAfter = retryAfter;
}
///
/// How long the server asked the caller to wait, or
/// if it did not say.
///
///
/// The client already honoured this across the attempts it made, capped at
/// . It is exposed here for
/// callers who want to reschedule the work.
///
public TimeSpan? RetryAfter { get; }
}