File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -88,14 +88,21 @@ public function connect($uri)
8888 // HHVM fails to parse URIs with a query but no path, so let's simplify our URI here
8989 $ remote = 'tcp:// ' . $ parts ['host ' ] . ': ' . $ parts ['port ' ];
9090
91- $ stream = @\stream_socket_client (
92- $ remote ,
93- $ errno ,
94- $ errstr ,
95- 0 ,
96- \STREAM_CLIENT_CONNECT | \STREAM_CLIENT_ASYNC_CONNECT ,
97- \stream_context_create ($ context )
98- );
91+ try {
92+ $ stream = @\stream_socket_client (
93+ $ remote ,
94+ $ errno ,
95+ $ errstr ,
96+ 0 ,
97+ \STREAM_CLIENT_CONNECT | \STREAM_CLIENT_ASYNC_CONNECT ,
98+ \stream_context_create ($ context )
99+ );
100+ } catch (\Exception $ e ) {
101+ return Promise \reject (new \RuntimeException (
102+ 'Connection to ' . $ uri . ' failed: ' . $ errstr . SocketServer::errconst ($ errno ),
103+ $ errno
104+ ));
105+ }
99106
100107 if (false === $ stream ) {
101108 return Promise \reject (new \RuntimeException (
You can’t perform that action at this time.
0 commit comments