using System; using System.Net; namespace Jellyfin.Plugin.Floatplane.Api; /// Floatplane answered with an error envelope. public class FloatplaneApiException : Exception { public FloatplaneApiException(HttpStatusCode status, string? errorName, string message) : base(message) { Status = status; ErrorName = errorName; } public HttpStatusCode Status { get; } /// e.g. notLoggedInError, notSubscribedError, paramValidationError. public string? ErrorName { get; } } /// The session cookie is missing, expired or not subscribed to the item. public class FloatplaneAuthException : FloatplaneApiException { public FloatplaneAuthException(HttpStatusCode status, string? errorName, string message) : base(status, errorName, message) { } } /// HTTP 429 from Floatplane or Cloudflare. public class FloatplaneRateLimitException : FloatplaneApiException { public FloatplaneRateLimitException(TimeSpan retryAfter, string message) : base(HttpStatusCode.TooManyRequests, "rateLimited", message) { RetryAfter = retryAfter; } public TimeSpan RetryAfter { get; } }