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

Error received from Telegram GetUpdates Request: null: Telegram API error details being masked by bad exception handling #1452

Open
twaslowski opened this issue Nov 4, 2024 · 1 comment

Comments

@twaslowski
Copy link

twaslowski commented Nov 4, 2024

Describe the bug

I'm currently getting the following stacktrace:

2024-11-04 07:27:28,201 ERROR [pool-4-thread-1] o.t.t.l.BotSession - [] Error received from Telegram GetUpdates Request, retrying in 269 millis...
org.telegram.telegrambots.longpolling.exceptions.TelegramApiErrorResponseException: null
	at org.telegram.telegrambots.longpolling.BotSession.getUpdatesFromTelegram(BotSession.java:156)
	at org.telegram.telegrambots.longpolling.BotSession.lambda$createPollerTask$1(BotSession.java:103)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:358)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: org.telegram.telegrambots.longpolling.exceptions.TelegramApiErrorResponseException:
	at org.telegram.telegrambots.longpolling.BotSession.getUpdatesFromTelegram(BotSession.java:152)
	... 7 common frames omitted

Expected behavior

If the Telegram API responds with a non-2xx status code, I should be able to see error details. When the API response is unsuccessful, a TelegramApiErrorResponseException containing the status code and message is thrown. However, this exception is immediately caught and wrapped in an instance of itself, with the code simply being overwritten/nulled, as can be seen here.

Additional context

Something like this shows up in #1401 as well, it seems.

I'll do some experiments with a fork of this project to see if I can make some progress on this myself. I just wanted to have this issue tracked in case other people run into it as well.

@twaslowski twaslowski changed the title Error received from Telegram GetUpdates Request: null: Telegram API error messages being masked by NullPointerException Error received from Telegram GetUpdates Request: null: Telegram API error details being masked by bad exception handling Nov 4, 2024
@twaslowski
Copy link
Author

Addressed by #1453.

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

No branches or pull requests

1 participant