Browse Source

Merge pull request #2511 from nextcloud/unknownErrorMessage

added more information on initial connection error
Andy Scherzinger 7 years ago
parent
commit
f32cb018d8

+ 11 - 1
src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -1559,8 +1559,18 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                 mServerStatusText = getResources().getString(R.string.auth_oauth_error_access_denied);
                 mServerStatusText = getResources().getString(R.string.auth_oauth_error_access_denied);
                 break;
                 break;
             case UNHANDLED_HTTP_CODE:
             case UNHANDLED_HTTP_CODE:
+                mServerStatusText = getResources().getString(R.string.auth_unknown_error_http_title);
+                break;
             case UNKNOWN_ERROR:
             case UNKNOWN_ERROR:
-                mServerStatusText = getResources().getString(R.string.auth_unknown_error_title);
+                if (result.getException() != null &&
+                        !TextUtils.isEmpty(result.getException().getMessage())) {
+                    mServerStatusText = getResources().getString(
+                            R.string.auth_unknown_error_exception_title,
+                            result.getException().getMessage()
+                    );
+                } else {
+                    mServerStatusText = getResources().getString(R.string.auth_unknown_error_title);
+                }
                 break;
                 break;
             case OK_REDIRECT_TO_NON_SECURE_CONNECTION:
             case OK_REDIRECT_TO_NON_SECURE_CONNECTION:
                 mServerStatusIcon = R.drawable.ic_lock_open_white;
                 mServerStatusIcon = R.drawable.ic_lock_open_white;

+ 2 - 0
src/main/res/values/strings.xml

@@ -239,7 +239,9 @@
 	<string name="auth_not_configured_title">Malformed server configuration</string>
 	<string name="auth_not_configured_title">Malformed server configuration</string>
 	<string name="auth_account_not_new">An account for the same user and server already exists on the device</string>
 	<string name="auth_account_not_new">An account for the same user and server already exists on the device</string>
 	<string name="auth_account_not_the_same">The entered user does not match the user of this account</string>
 	<string name="auth_account_not_the_same">The entered user does not match the user of this account</string>
+	<string name="auth_unknown_error_http_title">Unknown HTTP error occurred!</string>
 	<string name="auth_unknown_error_title">Unknown error occurred!</string>
 	<string name="auth_unknown_error_title">Unknown error occurred!</string>
+	<string name="auth_unknown_error_exception_title">Unknown error: %1$s</string>
 	<string name="auth_unknown_host_title">Could not find host</string>
 	<string name="auth_unknown_host_title">Could not find host</string>
 	<string name="auth_incorrect_path_title">Server not found</string>
 	<string name="auth_incorrect_path_title">Server not found</string>
 	<string name="auth_timeout_title">The server took too long to respond</string>
 	<string name="auth_timeout_title">The server took too long to respond</string>