From 183973066328f7203ef799a4c4597832d8ffa7de Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 9 Mar 2020 01:06:14 +0800 Subject: ModuleDownloaderPreference: properly use errormessages Signed-off-by: Jason A. Donenfeld --- app/src/main/java/com/wireguard/android/backend/BackendException.java | 1 - .../com/wireguard/android/preference/ModuleDownloaderPreference.java | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'app/src') diff --git a/app/src/main/java/com/wireguard/android/backend/BackendException.java b/app/src/main/java/com/wireguard/android/backend/BackendException.java index 2994e02a..e1e8eaa9 100644 --- a/app/src/main/java/com/wireguard/android/backend/BackendException.java +++ b/app/src/main/java/com/wireguard/android/backend/BackendException.java @@ -14,7 +14,6 @@ public final class BackendException extends Exception { UNABLE_TO_START_VPN, TUN_CREATION_ERROR, GO_ACTIVATION_ERROR_CODE - } private final Reason reason; private final Object[] format; diff --git a/app/src/main/java/com/wireguard/android/preference/ModuleDownloaderPreference.java b/app/src/main/java/com/wireguard/android/preference/ModuleDownloaderPreference.java index a04bed76..aac649dd 100644 --- a/app/src/main/java/com/wireguard/android/preference/ModuleDownloaderPreference.java +++ b/app/src/main/java/com/wireguard/android/preference/ModuleDownloaderPreference.java @@ -13,6 +13,7 @@ import android.widget.Toast; import com.wireguard.android.Application; import com.wireguard.android.R; +import com.wireguard.android.util.ErrorMessages; import com.wireguard.android.util.ModuleLoader; import com.wireguard.android.util.ToolsInstaller; @@ -45,7 +46,7 @@ public class ModuleDownloaderPreference extends Preference { private void onDownloadResult(final Integer result, @Nullable final Throwable throwable) { if (throwable != null) { setState(State.FAILURE); - Toast.makeText(getContext(), throwable.getMessage(), Toast.LENGTH_LONG).show(); + Toast.makeText(getContext(), ErrorMessages.get(throwable), Toast.LENGTH_LONG).show(); } else if (result == OsConstants.ENOENT) setState(State.NOTFOUND); else if (result == OsConstants.EXIT_SUCCESS) { -- cgit v1.2.3