@@ -170,6 +170,8 @@ $proxy->connect('tcp://smtp.googlemail.com:587')->then(function (React\Socket\Co
170
170
$connection->on('data', function ($chunk) use ($connection) {
171
171
echo $chunk;
172
172
});
173
+ }, function (Exception $e) {
174
+ echo 'Error: ' . $e->getMessage() . PHP_EOL;
173
175
});
174
176
```
175
177
@@ -189,6 +191,8 @@ $connector->connect('tcp://smtp.googlemail.com:587')->then(function (React\Socke
189
191
$connection->on('data', function ($chunk) use ($connection) {
190
192
echo $chunk;
191
193
});
194
+ }, function (Exception $e) {
195
+ echo 'Error: ' . $e->getMessage() . PHP_EOL;
192
196
});
193
197
```
194
198
@@ -215,6 +219,8 @@ $connector->connect('tls://smtp.googlemail.com:465')->then(function (React\Socke
215
219
$connection->on('data', function ($chunk) use ($connection) {
216
220
echo $chunk;
217
221
});
222
+ }, function (Exception $e) {
223
+ echo 'Error: ' . $e->getMessage() . PHP_EOL;
218
224
});
219
225
```
220
226
@@ -247,7 +253,7 @@ $browser->get('https://example.com/')->then(function (Psr\Http\Message\ResponseI
247
253
```
248
254
249
255
See also [ ReactPHP's HTTP client] ( https://github.com/reactphp/http#client-usage )
250
- and any of the [ examples] ( examples ) for more details.
256
+ and any of the [ examples] ( examples/ ) for more details.
251
257
252
258
#### Connection timeout
253
259
@@ -275,6 +281,8 @@ $connector = new React\Socket\Connector(array(
275
281
276
282
$connector->connect('tcp://google.com:80')->then(function ($connection) {
277
283
// connection succeeded within 3.0 seconds
284
+ }, function (Exception $e) {
285
+ echo 'Error: ' . $e->getMessage() . PHP_EOL;
278
286
});
279
287
```
280
288
@@ -412,6 +420,8 @@ $proxy = new Clue\React\HttpProxy\ProxyConnector('http+unix:///tmp/proxy.sock');
412
420
413
421
$proxy->connect('tcp://google.com:80')->then(function (React\Socket\ConnectionInterface $connection) {
414
422
// connected…
423
+ }, function (Exception $e) {
424
+ echo 'Error: ' . $e->getMessage() . PHP_EOL;
415
425
});
416
426
```
417
427
0 commit comments