Skip to content

Commit 6717d0c

Browse files
committed
Use correct exception on connect
1 parent 3bdc0a2 commit 6717d0c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Client.php

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Http\Client\Socket\Exception\ConnectionException;
77
use Http\Client\Socket\Exception\InvalidRequestException;
88
use Http\Client\Socket\Exception\SSLConnectionException;
9+
use Http\Client\Socket\Exception\TimeoutException;
910
use Psr\Http\Message\RequestInterface;
1011
use Psr\Http\Message\ResponseInterface;
1112
use Symfony\Component\OptionsResolver\Options;
@@ -116,6 +117,10 @@ protected function createSocket(RequestInterface $request, string $remote, bool
116117
$socket = @stream_socket_client($remote, $errNo, $errMsg, floor($this->config['timeout'] / 1000), STREAM_CLIENT_CONNECT, $this->config['stream_context']);
117118

118119
if (false === $socket) {
120+
if (110 === $errNo) {
121+
throw new TimeoutException($errMsg, $request);
122+
}
123+
119124
throw new ConnectionException($errMsg, $request);
120125
}
121126

0 commit comments

Comments
 (0)