ModuleDownloaderPreference: properly use errormessages
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
afd75cc4cf
commit
1839730663
@ -14,7 +14,6 @@ public final class BackendException extends Exception {
|
|||||||
UNABLE_TO_START_VPN,
|
UNABLE_TO_START_VPN,
|
||||||
TUN_CREATION_ERROR,
|
TUN_CREATION_ERROR,
|
||||||
GO_ACTIVATION_ERROR_CODE
|
GO_ACTIVATION_ERROR_CODE
|
||||||
|
|
||||||
}
|
}
|
||||||
private final Reason reason;
|
private final Reason reason;
|
||||||
private final Object[] format;
|
private final Object[] format;
|
||||||
|
@ -13,6 +13,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import com.wireguard.android.Application;
|
import com.wireguard.android.Application;
|
||||||
import com.wireguard.android.R;
|
import com.wireguard.android.R;
|
||||||
|
import com.wireguard.android.util.ErrorMessages;
|
||||||
import com.wireguard.android.util.ModuleLoader;
|
import com.wireguard.android.util.ModuleLoader;
|
||||||
import com.wireguard.android.util.ToolsInstaller;
|
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) {
|
private void onDownloadResult(final Integer result, @Nullable final Throwable throwable) {
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
setState(State.FAILURE);
|
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)
|
} else if (result == OsConstants.ENOENT)
|
||||||
setState(State.NOTFOUND);
|
setState(State.NOTFOUND);
|
||||||
else if (result == OsConstants.EXIT_SUCCESS) {
|
else if (result == OsConstants.EXIT_SUCCESS) {
|
||||||
|
Loading…
Reference in New Issue
Block a user