summaryrefslogtreecommitdiffstats
path: root/src/RateLimitedException.php
diff options
context:
space:
mode:
authorMurilo Ijanc <[email protected]>2026-07-26 14:58:55 -0300
committerMurilo Ijanc <[email protected]>2026-07-26 14:58:55 -0300
commit64764fb9fac0227f8e0443e7c7519d73aec275b9 (patch)
treecb4fc56eeb6ecce53854f9c530609cf01ab3349f /src/RateLimitedException.php
downloadphp-64764fb9fac0227f8e0443e7c7519d73aec275b9.tar.gz
Initial importv0.1.0
Diffstat (limited to 'src/RateLimitedException.php')
-rw-r--r--src/RateLimitedException.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/RateLimitedException.php b/src/RateLimitedException.php
new file mode 100644
index 0000000..579fe7b
--- /dev/null
+++ b/src/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);
+ }
+}