Closed tshavkat closed 4 years ago
@rubenlagus I think need to show telegram error message in the case of an error on getting updates. For time being, the exception above is not useful. What do you think? I can prepare PR to logging telegram error messages
Just doing a test on it it looks like it is working fine:
ApiResponse<Message> response = new ApiResponse<Message>() {
@Override
public Boolean getOk() {
return super.getOk();
}
@Override
public Integer getErrorCode() {
return 404;
}
@Override
public String getErrorDescription() {
return "This is my error description";
}
@Override
public ResponseParameters getParameters() {
return new ResponseParameters() {
@Override
public Long getMigrateToChatId() {
return super.getMigrateToChatId();
}
@Override
public Integer getRetryAfter() {
return 5000;
}
};
}
};
TelegramApiException exc = new TelegramApiRequestException("This is an exception", response);
log.error(exc.getMessage(), exc);
Prints
2020-04-26T01:10:00.720+0100 [main] ERROR TriviaApplication - This is an exception org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException: This is an exception: [404] This is my error description at .main(MainApplication.java:81)
ERROR 232 --- [gram Connection] o.t.t.u.DefaultBotSession : Error getting updates
org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException: Error getting updates at org.telegram.telegrambots.meta.api.methods.updates.GetUpdates.deserializeResponse(GetUpdates.java:118) ~[telegrambots-meta-4.4.0.1.jar:na] at org.telegram.telegrambots.updatesreceivers.DefaultBotSession$ReaderThread.getUpdatesFromServer(DefaultBotSession.java:258) ~[telegrambots-4.4.0.1.jar:na] at org.telegram.telegrambots.updatesreceivers.DefaultBotSession$ReaderThread.run(DefaultBotSession.java:187) ~[telegrambots-4.4.0.1.jar:na]