Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return value of Http\Client\Curl\PromiseCore::getException() must implement interface Throwable, instance of Nyholm\Psr7\Response #60

Open
luckyraul opened this issue Oct 15, 2019 · 3 comments

Comments

@luckyraul
Copy link

luckyraul commented Oct 15, 2019

PHP message: PHP Fatal error: Uncaught TypeError: Return value of Http\Client\Curl\PromiseCore::getException() must implement interface Throwable, instance of Nyholm\Psr7\Response returned in /var/www/releases/20191015093018/vendor/php-http/curl-client/src/PromiseCore.php:194

Stack trace:
#0 /var/www/releases/20191015093018/vendor/php-http/curl-client/src/CurlPromise.php(103): Http\Client\Curl\PromiseCore->getException()
#1 /var/www/releases/20191015093018/vendor/sentry/sentry/src/Transport/HttpTransport.php(110): Http\Client\Curl\CurlPromise->wait()
#2 /var/www/releases/20191015093018/vendor/sentry/sentry/src/Client.php(117): Sentry\Transport\HttpTransport->send(Object(Sentry\Event))
#3 /var/www/releases/20191015093018/vendor/sentry/sentry/src/Client.php(103): Sentry\Client->captureEvent(Array, Object(Sentry\State\Scope))
@qkdreyer
Copy link

TypeError: Return value of Http\Client\Curl\PromiseCore::getException() must implement interface Throwable, instance of Zend\Diactoros\Response returned
#25 /vendor/php-http/curl-client/src/PromiseCore.php(194): Http\Client\Curl\PromiseCore::getException
#24 /vendor/php-http/curl-client/src/CurlPromise.php(103): Http\Client\Curl\CurlPromise::wait
#23 /vendor/sentry/sentry/src/Transport/HttpTransport.php(110): Sentry\Transport\HttpTransport::send
#22 /vendor/sentry/sentry/src/Client.php(117): Sentry\Client::captureEvent
#21 /vendor/sentry/sentry/src/State/Hub.php(146): Sentry\State\Hub::captureEvent
#20 /vendor/sentry/sentry/src/Monolog/Handler.php(73): Sentry\Monolog\Handler::Sentry\Monolog\{closure}
#19 /vendor/sentry/sentry/src/State/Hub.php(87): Sentry\State\Hub::withScope
#18 /vendor/sentry/sentry/src/Monolog/Handler.php(74): Sentry\Monolog\Handler::write

@drunken-monkey
Copy link

The problem seems to be in \Http\Client\Curl\PromiseCore::reject(): $this->exception is set to the return value of an onRejected callback, but these are apparently expected to return a response or throw an exception, not to return an exception. (Especially, you definitely cannot rely on them returning an exception, but should at least check if that is the case.) See \Http\Client\Common\Plugin\RetryPlugin::handleRequest() in the php-http/client-common package for an example.

@dbu
Copy link
Contributor

dbu commented Feb 17, 2023

@joelwurtz could you maybe help sort out what would be the correct behaviour?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants