2021-08-27 15:03:47 +00:00
|
|
|
using System;
|
2020-12-22 12:15:26 +00:00
|
|
|
|
|
|
|
using Myriad.Rest.Ratelimit;
|
|
|
|
|
|
|
|
namespace Myriad.Rest.Exceptions
|
|
|
|
{
|
|
|
|
public class RatelimitException: Exception
|
|
|
|
{
|
2021-08-27 15:03:47 +00:00
|
|
|
public RatelimitException(string? message) : base(message) { }
|
2020-12-22 12:15:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public class RatelimitBucketExhaustedException: RatelimitException
|
|
|
|
{
|
2021-08-27 15:03:47 +00:00
|
|
|
public RatelimitBucketExhaustedException(Bucket bucket, TimeSpan retryAfter) : base(
|
2020-12-22 12:15:26 +00:00
|
|
|
"Rate limit bucket exhausted, request blocked")
|
|
|
|
{
|
|
|
|
Bucket = bucket;
|
|
|
|
RetryAfter = retryAfter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Bucket Bucket { get; }
|
|
|
|
public TimeSpan RetryAfter { get; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public class GloballyRatelimitedException: RatelimitException
|
|
|
|
{
|
2021-08-27 15:03:47 +00:00
|
|
|
public GloballyRatelimitedException() : base("Global rate limit hit") { }
|
2020-12-22 12:15:26 +00:00
|
|
|
}
|
|
|
|
}
|