irazasyed / telegram-bot-sdk

🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
https://telegram-bot-sdk.com
BSD 3-Clause "New" or "Revised" License
3.04k stars 671 forks source link

Catch exception if user blocked the bot #1121

Open TheRedEclipse opened 8 months ago

TheRedEclipse commented 8 months ago

PHP version

8.1

irazasyed/telegram-bot-sdk version

3.9

Laravel version (if any)

8

Code To Reproduce the bug

Hello, I trying to catch the error when user blocks the bot. But for some reason on production when I trying to catch an exception I'm gettting Fatal error. Any suggestions how to fix that?

`try { Telegram::sendMessage($params);

} catch (TelegramResponseException $e) {

'we have got error' }`

Error stacktrace (if any)

` PHP Fatal error: Uncaught Error: Call to undefined function GuzzleHttp\Promise\unwrap() in /vendor/irazasyed/telegram-bot-sdk/src/HttpClients/GuzzleHttpClient.php:50 Stack trace:

0 [internal function]: Telegram\Bot\HttpClients\GuzzleHttpClient->__destruct()

1 {main}

thrown in /vendor/irazasyed/telegram-bot-sdk/src/HttpClients/GuzzleHttpClient.php on line 50 `