Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stefan-niedermann/nextcloud-deck.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordesperateCoder <echotodevnull@gmail.com>2024-01-03 18:18:26 +0300
committerdesperateCoder <echotodevnull@gmail.com>2024-01-03 18:18:26 +0300
commit48344359a31fcc7735619978ee5407eeb43c2bcd (patch)
tree3e4d7950fb78c3105bea161868a8c804caf9135a /app/src/main
parent7fa4e26314a90258df6eb0bd71e09036763c08fb (diff)
added known exception for cloudflare-caused issues
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/it/niedermann/nextcloud/deck/exceptions/OfflineException.java1
-rw-r--r--app/src/main/java/it/niedermann/nextcloud/deck/remote/api/ServerCommunicationErrorHandler.java4
-rw-r--r--app/src/main/res/values/strings.xml1
3 files changed, 5 insertions, 1 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/exceptions/OfflineException.java b/app/src/main/java/it/niedermann/nextcloud/deck/exceptions/OfflineException.java
index 1415659a5..946f7b049 100644
--- a/app/src/main/java/it/niedermann/nextcloud/deck/exceptions/OfflineException.java
+++ b/app/src/main/java/it/niedermann/nextcloud/deck/exceptions/OfflineException.java
@@ -27,6 +27,7 @@ public class OfflineException extends IllegalStateException {
OFFLINE("Device is currently offline", R.string.error_dialog_tip_offline_no_internet),
CONNECTION_REFUSED("Connection refused", R.string.error_dialog_tip_offline_connection_refused),
CONNECTION_TIMEOUT("Connection timeout", R.string.error_dialog_tip_offline_connection_timeout),
+ CONNECTION_REJECTED("Connection rejected", R.string.error_dialog_tip_connection_rejected),
;
private final String key;
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/remote/api/ServerCommunicationErrorHandler.java b/app/src/main/java/it/niedermann/nextcloud/deck/remote/api/ServerCommunicationErrorHandler.java
index 562e9c3cb..656aed0ce 100644
--- a/app/src/main/java/it/niedermann/nextcloud/deck/remote/api/ServerCommunicationErrorHandler.java
+++ b/app/src/main/java/it/niedermann/nextcloud/deck/remote/api/ServerCommunicationErrorHandler.java
@@ -2,6 +2,7 @@ package it.niedermann.nextcloud.deck.remote.api;
import androidx.annotation.NonNull;
+import com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException;
import com.nextcloud.android.sso.exceptions.UnknownErrorException;
import java.util.Arrays;
@@ -16,7 +17,8 @@ public class ServerCommunicationErrorHandler {
private static final Handler[] handlers = new Handler[]{
new Handler(UnknownErrorException.class, Arrays.asList("econnrefused", "unable to resolve host",
"connection refused", "no address associated with hostname"), OfflineException.Reason.CONNECTION_REFUSED),
- new Handler(ClassNotFoundException.class, Collections.singletonList("connecttimeoutexception"), OfflineException.Reason.CONNECTION_TIMEOUT)
+ new Handler(ClassNotFoundException.class, Collections.singletonList("connecttimeoutexception"), OfflineException.Reason.CONNECTION_TIMEOUT),
+ new Handler(NextcloudHttpRequestFailedException.class, Collections.singletonList("520"), OfflineException.Reason.CONNECTION_REJECTED)
};
public static Throwable translateError(Throwable error) {
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 23c2b079b..8ae0eff5f 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -241,6 +241,7 @@
<string name="error_dialog_tip_offline_no_internet">It looks like you tried to trigger a synchronization without an internet connection.</string>
<string name="error_dialog_tip_offline_connection_refused">Connection was refused, please check if your server is reachable via web browser.</string>
<string name="error_dialog_tip_offline_connection_timeout">Connection timed out, please check if you\'re connected to the internet. This may also happen when your server is busy.</string>
+ <string name="error_dialog_tip_connection_rejected">Connection was rejected, please check if your server is protected by an anti-flooding mechanism. This is most likely a problem caused by Cloudflare protected Servers.</string>
<string name="error_dialog_tip_sync_only_on_wifi">If you have enabled the "Sync only on Wi-Fi" setting, you can only synchronize when you are connected to a Wi-Fi.</string>
<string name="error_dialog_tip_files_force_stop">Something seems to be wrong with your Nextcloud app. Please try to force stop both, the Nextcloud app and the Nextcloud Deck app.</string>
<string name="error_dialog_tip_files_delete_storage">If force stopping them does not help, you can try to clear the storage of both apps.</string>