Merge pull request #898 from slavino/patch-1

Update TelegramApiRequestException.java
This commit is contained in:
Ruben Bermudez 2021-04-25 01:49:47 +01:00 committed by GitHub
commit 58de20ae9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,8 +84,13 @@ public class TelegramApiRequestException extends TelegramApiException {
return parameters;
}
/**
* More detailed error description.
*
* @return assembled response code and reason
*/
@Override
public String toString() {
public String getMessage() {
if (apiResponse == null) {
return super.toString();
} else if (errorCode == null) {
@ -94,4 +99,15 @@ public class TelegramApiRequestException extends TelegramApiException {
return super.toString() + ": [" + errorCode + "] " + apiResponse;
}
}
/**
* Just left as backward compatibility if anybody used this in version 5.1.1 or older.
*
* @return the getMessage string
*/
@Override
public String toString() {
return getMessage();
}
}