TelegramBots
TelegramBots copied to clipboard
Proper handling of errors returned by telegram API
Polling Bot Errors from telegram were not logged properly - you never know what exacty telegram wants to tell you All error details are added to the exception message which is always logged with the stacktrace
In Telegram Client HTTP error codes were not hadled at all - onFailure
is only called on HTTP transport errors (cancellation, a connectivity problem or timeout), HTTP response coded should be handled in onResponse
We only knew about TG API errors by seend parsing exceptions, when error structure could not be pased as an expected java class
Now only 2xx responses are parsed normally, for other responses we gather details and throw an exception