ModuleDownloaderPreference: properly use errormessages

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-03-09 01:06:14 +08:00
parent afd75cc4cf
commit 1839730663
2 changed files with 2 additions and 2 deletions

View File

@ -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;

View File

@ -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) {