diff --git a/src/Symfony/Component/HttpClient/Psr18Client.php b/src/Symfony/Component/HttpClient/Psr18Client.php index 9ec7a08490..a251d42836 100644 --- a/src/Symfony/Component/HttpClient/Psr18Client.php +++ b/src/Symfony/Component/HttpClient/Psr18Client.php @@ -105,7 +105,7 @@ final class Psr18Client implements ClientInterface /** * @internal */ -trait Psr18ExceptionTrait +class Psr18NetworkException extends \RuntimeException implements NetworkExceptionInterface { private $request; @@ -121,18 +121,21 @@ trait Psr18ExceptionTrait } } -/** - * @internal - */ -class Psr18NetworkException extends \RuntimeException implements NetworkExceptionInterface -{ - use Psr18ExceptionTrait; -} - /** * @internal */ class Psr18RequestException extends \InvalidArgumentException implements RequestExceptionInterface { - use Psr18ExceptionTrait; + private $request; + + public function __construct(TransportExceptionInterface $e, RequestInterface $request) + { + parent::__construct($e->getMessage(), 0, $e); + $this->request = $request; + } + + public function getRequest(): RequestInterface + { + return $this->request; + } }