This repository was archived by the owner on Jun 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /*
4+ * This file is part of the Apisearch PHP Client.
5+ *
6+ * For the full copyright and license information, please view the LICENSE
7+ * file that was distributed with this source code.
8+ *
9+ * Feel free to edit as you please, and have fun.
10+ *
11+ * @author Marc Morera <yuhu@mmoreram.com>
12+ */
13+
14+ declare (strict_types=1 );
15+
16+ namespace Apisearch \Exception ;
17+
18+ /**
19+ * Class TooManyRequestsException
20+ */
21+ class TooManyRequestsException extends TransportableException
22+ {
23+ /**
24+ * Get http error code.
25+ *
26+ * @return int
27+ */
28+ public static function getTransportableHTTPError (): int
29+ {
30+ return 429 ;
31+ }
32+
33+ /**
34+ * Index exists.
35+ *
36+ * @return ResourceExistsException
37+ */
38+ public static function tooManyRequestsReached (): self
39+ {
40+ return new self ('You reached the rate limit. Please, check your permissions ' );
41+ }
42+ }
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ protected static function throwTransportableExceptionIfNeeded(
5858 case ForbiddenException::getTransportableHTTPError ():
5959 throw new ForbiddenException ($ response ['body ' ]['message ' ]);
6060 case ConnectionException::getTransportableHTTPError ():
61- throw new ConnectionException ('Apisearch returned an internal error code [500] ' );
61+ throw new ConnectionException ('Apisearch returned an internal error code [500] - ' . $ response [ ' body ' ][ ' message ' ] );
6262 }
6363 }
6464}
You can’t perform that action at this time.
0 commit comments