File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed
Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1111 }
1212 ],
1313 "require" : {
14- "php" : " ^7.4|^8.0|8.1.* " ,
14+ "php" : " ^7.4|^8.0|^ 8.1" ,
1515 "ext-curl" : " *" ,
1616 "ext-json" : " *" ,
1717 "guzzlehttp/guzzle" : " ^7.0" ,
Original file line number Diff line number Diff line change 55namespace FlixTech \SchemaRegistryApi \Exception ;
66
77use Exception ;
8+ use GuzzleHttp \Exception \GuzzleException ;
89use GuzzleHttp \Exception \RequestException ;
910use Psr \Http \Message \ResponseInterface ;
1011use RuntimeException ;
@@ -38,14 +39,18 @@ private function __construct()
3839 /**
3940 * Maps a RequestException to the internal SchemaRegistryException types.
4041 *
41- * @param RequestException $exception
42+ * @param GuzzleException $exception
4243 *
4344 * @return SchemaRegistryException
4445 *
4546 * @throws RuntimeException
4647 */
47- public function __invoke (RequestException $ exception ): SchemaRegistryException
48+ public function __invoke (GuzzleException $ exception ): SchemaRegistryException
4849 {
50+ if (!$ exception instanceof RequestException) {
51+ throw $ exception ;
52+ }
53+
4954 $ response = $ this ->guardAgainstMissingResponse ($ exception );
5055 $ decodedBody = $ this ->guardAgainstMissingErrorCode ($ response );
5156 $ errorCode = $ decodedBody [self ::ERROR_CODE_FIELD_NAME ];
Original file line number Diff line number Diff line change 1010use FlixTech \SchemaRegistryApi \Exception \ExceptionMap ;
1111use FlixTech \SchemaRegistryApi \Schema \AvroReference ;
1212use GuzzleHttp \ClientInterface ;
13- use GuzzleHttp \Exception \RequestException ;
13+ use GuzzleHttp \Exception \GuzzleException ;
1414use GuzzleHttp \Promise \PromiseInterface ;
1515use InvalidArgumentException ;
1616use Psr \Http \Message \RequestInterface ;
@@ -45,7 +45,7 @@ public function __construct(ClientInterface $client)
4545 $ this ->client = $ client ;
4646 $ exceptionMap = ExceptionMap::instance ();
4747
48- $ this ->rejectedCallback = static function (RequestException $ exception ) use ($ exceptionMap ) {
48+ $ this ->rejectedCallback = static function (GuzzleException $ exception ) use ($ exceptionMap ) {
4949 return $ exceptionMap ($ exception );
5050 };
5151 }
You can’t perform that action at this time.
0 commit comments