diff --git a/src/platform/src/Exception/RateLimitExceededException.php b/src/platform/src/Exception/RateLimitExceededException.php index b64520b56..c162f3f2e 100644 --- a/src/platform/src/Exception/RateLimitExceededException.php +++ b/src/platform/src/Exception/RateLimitExceededException.php @@ -19,7 +19,7 @@ final class RateLimitExceededException extends RuntimeException public function __construct( private readonly ?float $retryAfter = null, ) { - parent::__construct('Rate limit exceeded.'); + parent::__construct('Rate limit exceeded.', 429); } public function getRetryAfter(): ?float diff --git a/src/platform/tests/Bridge/Anthropic/ResultConverterRateLimitTest.php b/src/platform/tests/Bridge/Anthropic/ResultConverterRateLimitTest.php index 86d9a0492..a92cf13d7 100644 --- a/src/platform/tests/Bridge/Anthropic/ResultConverterRateLimitTest.php +++ b/src/platform/tests/Bridge/Anthropic/ResultConverterRateLimitTest.php @@ -39,6 +39,7 @@ public function testRateLimitExceededThrowsException() $handler = new ResultConverter(); $this->expectException(RateLimitExceededException::class); + $this->expectExceptionCode(429); $this->expectExceptionMessage('Rate limit exceeded'); try { @@ -61,6 +62,7 @@ public function testRateLimitExceededWithoutRetryAfter() $handler = new ResultConverter(); $this->expectException(RateLimitExceededException::class); + $this->expectExceptionCode(429); $this->expectExceptionMessage('Rate limit exceeded'); try { diff --git a/src/platform/tests/Bridge/Gemini/Gemini/ResultConverterRateLimitTest.php b/src/platform/tests/Bridge/Gemini/Gemini/ResultConverterRateLimitTest.php index f180ebc90..83ce62dea 100644 --- a/src/platform/tests/Bridge/Gemini/Gemini/ResultConverterRateLimitTest.php +++ b/src/platform/tests/Bridge/Gemini/Gemini/ResultConverterRateLimitTest.php @@ -36,6 +36,7 @@ public function testRateLimitExceededThrowsException() $handler = new ResultConverter(); $this->expectException(RateLimitExceededException::class); + $this->expectExceptionCode(429); $this->expectExceptionMessage('Rate limit exceeded.'); try { diff --git a/src/platform/tests/Bridge/OpenAi/Gpt/ResultConverterRateLimitTest.php b/src/platform/tests/Bridge/OpenAi/Gpt/ResultConverterRateLimitTest.php index b3aeff43f..fff7bbc74 100644 --- a/src/platform/tests/Bridge/OpenAi/Gpt/ResultConverterRateLimitTest.php +++ b/src/platform/tests/Bridge/OpenAi/Gpt/ResultConverterRateLimitTest.php @@ -41,6 +41,7 @@ public function testRateLimitExceededWithRequestsResetTime() $handler = new ResultConverter(); $this->expectException(RateLimitExceededException::class); + $this->expectExceptionCode(429); $this->expectExceptionMessage('Rate limit exceeded.'); try { @@ -68,6 +69,7 @@ public function testRateLimitExceededWithTokensResetTime() $handler = new ResultConverter(); $this->expectException(RateLimitExceededException::class); + $this->expectExceptionCode(429); $this->expectExceptionMessage('Rate limit exceeded.'); try {