summaryrefslogtreecommitdiffstats
path: root/lib/cepis/RateLimitedException.php
diff options
context:
space:
mode:
authorMurilo Ijanc <[email protected]>2026-07-26 16:41:48 -0300
committerMurilo Ijanc <[email protected]>2026-07-26 16:47:14 -0300
commit535dbda6b48171f8115b455e54790de94d97d42a (patch)
tree5c0410011e61a883bdf063ee612875a637fb1d22 /lib/cepis/RateLimitedException.php
downloadwoocommerce-535dbda6b48171f8115b455e54790de94d97d42a.tar.gz
Initial importv0.1.0
Diffstat (limited to 'lib/cepis/RateLimitedException.php')
-rw-r--r--lib/cepis/RateLimitedException.php25
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);
+ }
+}