PluralKit/Myriad/Rest/Exceptions/RatelimitException.cs

26 lines
685 B
C#
Raw Normal View History

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