diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2025-08-14 14:37:56 +0200 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2025-08-14 14:37:56 +0200 |
commit | c135fcf9041c604b32827a1cb027010bca5915ab (patch) | |
tree | 95a2331d5f0bc4a736aa0e716330c39b3fa1ea26 /src/Errors/RateLimitError.php | |
parent | 3f4b51b99a4f4dc41dbdce7f34afe7e15d3d426e (diff) |
POST login possible
Diffstat (limited to 'src/Errors/RateLimitError.php')
-rw-r--r-- | src/Errors/RateLimitError.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Errors/RateLimitError.php b/src/Errors/RateLimitError.php new file mode 100644 index 0000000..d84f66a --- /dev/null +++ b/src/Errors/RateLimitError.php @@ -0,0 +1,20 @@ +<?php + +namespace App\Errors; + +use Symfony\Component\HttpFoundation\Response; + +class RateLimitError extends Exception +{ + public function __construct(private int $retryAfter) + { + parent::__construct(ErrorCode::LIMIT_EXCEEDED, "Too many requests", Response::HTTP_TOO_MANY_REQUESTS); + } + + public function getAdditionalData(): array + { + return [ + "retry_after_ms" => $this->retryAfter, + ]; + } +} |