Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught GuzzleHttp\Exception\ClientException: Client error #1134

Open
chukey opened this issue Jul 26, 2024 · 1 comment
Open

Uncaught GuzzleHttp\Exception\ClientException: Client error #1134

chukey opened this issue Jul 26, 2024 · 1 comment
Labels

Comments

@chukey
Copy link

chukey commented Jul 26, 2024

PHP version

8.1

irazasyed/telegram-bot-sdk version

^3.9

Laravel version (if any)

No response

Code To Reproduce the bug

$bot->sendMessage([
'chat_id'=>0,
'text'=>$text,
'parse_mode'=> 'html'
]);

Error stacktrace (if any)

i can not catch Exception
i tried any type of exception
\GuzzleHttp\Exception\ClientException
\GuzzleHttp\Exception\RequestException
TelegramSDKException

but always have fatal error
chat_id is 0, because it send from server for notification and chat_id maybe bad and i need catch this error

 try {
                $bot->sendMessage([
                    'chat_id'=>0,
                    'text'=>$text,
                    'parse_mode'=> 'html'
                ]);
        } catch (\GuzzleHttp\Exception\RequestException $e){
           
        }
@chukey chukey added the bug label Jul 26, 2024
@NikitinUser
Copy link

What if catch (\Throwable $e)?
"chat_id maybe bad" Why? You need to know chat_id to send a message. How else would Telegram understand who you're sending the message to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants