added new error messages

This commit is contained in:
nuclearfog 2020-12-23 20:08:45 +01:00
parent 20bfb8acb3
commit 72bbf7e814
No known key found for this signature in database
GPG Key ID: D5490E4A81F97B14
4 changed files with 26 additions and 4 deletions

View File

@ -13,7 +13,9 @@ public class EngineException extends Exception {
public enum ErrorType {
RATE_LIMIT_EX,
USER_NOT_FOUND,
REQ_TOKEN_EXPIRED,
APP_SUSPENDED,
ACCESS_TOKEN_DEAD,
TWEET_CANT_REPLY,
RESOURCE_NOT_FOUND,
CANT_SEND_DM,
NOT_AUTHORIZED,
@ -64,7 +66,11 @@ public class EngineException extends Exception {
break;
case 32:
errorType = ErrorType.REQ_TOKEN_EXPIRED;
errorType = ErrorType.ACCESS_TOKEN_DEAD;
break;
case 416:
errorType = ErrorType.APP_SUSPENDED;
break;
case 34: //
@ -101,6 +107,10 @@ public class EngineException extends Exception {
errorType = ErrorType.TOKEN_EXPIRED;
break;
case 385: // replying tweet that is not visible or deleted
errorType = ErrorType.TWEET_CANT_REPLY;
break;
default:
if (error.getStatusCode() == 401) {
errorType = ErrorType.NOT_AUTHORIZED;

View File

@ -44,7 +44,7 @@ public final class ErrorHandler {
Toast.makeText(context, R.string.error_user_not_found, Toast.LENGTH_SHORT).show();
break;
case REQ_TOKEN_EXPIRED:
case APP_SUSPENDED:
Toast.makeText(context, R.string.error_request_token, Toast.LENGTH_SHORT).show();
break;
@ -96,6 +96,14 @@ public final class ErrorHandler {
Toast.makeText(context, R.string.error_image_loading, Toast.LENGTH_SHORT).show();
break;
case ACCESS_TOKEN_DEAD:
Toast.makeText(context, R.string.error_cant_login, Toast.LENGTH_SHORT).show();
break;
case TWEET_CANT_REPLY:
Toast.makeText(context, R.string.error_cant_reply_to_tweet, Toast.LENGTH_SHORT).show();
break;
case ERROR_NOT_DEFINED:
if (error.getMessage() != null)
Toast.makeText(context, error.getMessage(), Toast.LENGTH_SHORT).show();

View File

@ -182,4 +182,6 @@
<string name="dialog_button_no">Nein</string>
<string name="dialog_button_cancel">Abbrechen</string>
<string name="dialog_button_ok">Ok</string>
<string name="error_cant_reply_to_tweet">Tweet ist nicht für Antworten freigegeben!</string>
<string name="error_cant_login">App ist nicht eingeloggt, Bitte neu einloggen!</string>
</resources>

View File

@ -157,7 +157,7 @@
<string name="error_image_save">Could not save Image</string>
<string name="error_not_authorized">Not authorized!</string>
<string name="error_file_format">File format not supported!</string>
<string name="error_request_token">Request token expired! please update app.</string>
<string name="error_request_token">API Keys are expired! please update app!</string>
<string name="error_empty_name">Empty user name!</string>
<string name="error_user_not_found">User not found!</string>
<string name="error_send_dm_to_user">cannot send dm to user!</string>
@ -167,6 +167,8 @@
<string name="error_dm_length">Directmessage is too long!</string>
<string name="error_list_title_empty">Empty list title!</string>
<string name="error_username_format">Wrong username format!</string>
<string name="error_cant_reply_to_tweet">You can\'t reply to this Tweet!</string>
<string name="error_cant_login">Can\'t login to Twitter, please Re-Login!</string>
<string name="error_not_defined">Not defined Error!</string>
<!-- menu icon strings -->