Skip to content

Fix issue with promises

Compare
Choose a tag to compare
@sagikazarmark sagikazarmark released this 31 Aug 08:47
· 58 commits to 2.x since this release

During the development of plugins we faced a problem with exceptions thrown in plugins.

Any exceptions not implementing Http\Client\Exception ended up in an invalid argument error because of these lines:

https://github.com/php-http/promise/blob/v1.0.0/src/RejectedPromise.php#L36-L38

This type leak allowed to inject an exception to be passed to the onRejected callback of a Promise.

In the current release we introduced HTTP specific promises which does not catch all exceptions, but HTTP ones. Every other exception will be thrown immediately.