Skip to content

Commit c324909

Browse files
authored
Add catch ConnectionException
handle getUpdates network connection error/disconnected
1 parent 26433b3 commit c324909

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Request.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use GuzzleHttp\Client;
1515
use GuzzleHttp\ClientInterface;
16+
use GuzzleHttp\Exception\ConnectException;
1617
use GuzzleHttp\Exception\RequestException;
1718
use GuzzleHttp\Psr7\Stream;
1819
use Longman\TelegramBot\Entities\File;
@@ -603,6 +604,9 @@ public static function execute(string $action, array $data = []): string
603604
$request_params
604605
);
605606
$result = (string) $response->getBody();
607+
} catch (ConnectException $e) {
608+
$response = null;
609+
$result = $e->getMessage();
606610
} catch (RequestException $e) {
607611
$response = null;
608612
$result = $e->getResponse() ? (string) $e->getResponse()->getBody() : '';

0 commit comments

Comments
 (0)