8p / EightPointsGuzzleBundle

⛽️ Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony
MIT License
440 stars 71 forks source link

Error "Argument #1 ($reason) must be of type Exception, TypeError given" #332

Closed alexbuyanow closed 10 months ago

alexbuyanow commented 11 months ago
Q A
Symfony version 5.4.27
Bundle version v8.4.0

Hello all!

Sometimes got error EightPoints\Bundle\GuzzleBundle\Middleware\EventDispatchMiddleware::EightPoints\Bundle\GuzzleBundle\Middleware\{closure}(): Argument #1 ($reason) must be of type Exception, TypeError given, called in /var/www/loyalty_service/vendor/guzzlehttp/promises/src/Promise.php on line 209

I guess problem is that. Some errors like \TypeError extend \Error and implement \Throwable, but do not extend \Exception In other side eightpoints/guzzle-bundle/src/Middleware/EventDispatchMiddleware.php:73

                    function (Exception $reason) {
                        // Get the response. The response in a RequestException can be null too.
                        $response = $reason instanceof RequestException ? $reason->getResponse() : null;

May be would better to change \Exception to \Throwable?

gregurco commented 10 months ago

Hello thank you for reporting that issue! Did a PR: #338 (merged). It will be released tomorrow.