summaryrefslogtreecommitdiffstats
path: root/lib/cepis/RateLimitedException.php
blob: 579fe7bd855e04ff4f75a0cc2b1f5a7506739594 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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);
    }
}