diff options
Diffstat (limited to 'lib/cepis/RateLimitedException.php')
| -rw-r--r-- | lib/cepis/RateLimitedException.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/cepis/RateLimitedException.php b/lib/cepis/RateLimitedException.php new file mode 100644 index 0000000..579fe7b --- /dev/null +++ b/lib/cepis/RateLimitedException.php @@ -0,0 +1,25 @@ +<?php + +declare(strict_types=1); + +namespace Cepis; + +/** + * The API (or the edge in front of it) answered 429 on every attempt. + */ +final class RateLimitedException extends \RuntimeException implements CepisException +{ + /** + * @param float|null $retryAfter What the server asked for, in seconds, or + * `null` if it did not say. The client already honoured this across + * the attempts it made; it is exposed for callers who want to + * reschedule the work. + */ + public function __construct( + string $message, + public readonly ?float $retryAfter = null, + ?\Throwable $previous = null, + ) { + parent::__construct($message, 0, $previous); + } +} |