diff options
author | Roopesh Chander <roop@roopc.net> | 2018-11-01 16:58:33 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2018-11-01 16:58:33 +0530 |
commit | 3611f8cf5afe709a9d84a4edd68666480ed04223 (patch) | |
tree | 398fe7bb74c37976d8deab322e88ba3f6442e6c9 /WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift | |
parent | TunnelsManager: Better errors (diff) | |
download | wireguard-apple-3611f8cf5afe709a9d84a4edd68666480ed04223.tar.xz wireguard-apple-3611f8cf5afe709a9d84a4edd68666480ed04223.zip |
Tunnel errors: Consolidate tunnel activation errors into ErrorPresenter
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to '')
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift index 3ef672a..66b404c 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift @@ -245,15 +245,11 @@ extension TunnelsListTableViewController { cell.onSwitchToggled = { [weak self] isOn in guard let s = self, let tunnelsManager = s.tunnelsManager else { return } if (isOn) { - tunnelsManager.startActivation(of: tunnel) { error in + tunnelsManager.startActivation(of: tunnel) { [weak s] error in if let error = error { - switch (error) { - case TunnelActivationError.noEndpoint: - self?.showErrorAlert(title: "Endpoint missing", message: "There must be at least one peer with an endpoint") - case TunnelActivationError.dnsResolutionFailed: - self?.showErrorAlert(title: "DNS Failure", message: "One or more endpoint domains could not be resolved") - default: - self?.showErrorAlert(title: "Internal error", message: "The tunnel could not be activated") + ErrorPresenter.showErrorAlert(error: error, from: s) + DispatchQueue.main.async { + cell.statusSwitch.isOn = false } } } |