Skip to content

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

@twaslowski

Description

@twaslowski

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions