diff options
author | Roopesh Chander <roop@roopc.net> | 2018-10-30 00:24:50 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2018-10-30 00:24:50 +0530 |
commit | 38e4e274aa402788ce89294aece498a2c742f231 (patch) | |
tree | 480e94191d81bfbdb5c73ec5a7d1b287bcf0cf58 /WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift | |
parent | VPN: Specify an error when there are no peers with an endpoint (diff) | |
download | wireguard-apple-38e4e274aa402788ce89294aece498a2c742f231.tar.xz wireguard-apple-38e4e274aa402788ce89294aece498a2c742f231.zip |
VPN: Better error messages
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift')
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift index d5b75b3..d86c1d6 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift @@ -165,11 +165,19 @@ extension TunnelDetailTableViewController { let cell = tableView.dequeueReusableCell(withIdentifier: TunnelDetailTableViewStatusCell.id, for: indexPath) as! TunnelDetailTableViewStatusCell cell.tunnel = self.tunnel cell.onSwitchToggled = { [weak self] isOn in - cell.isSwitchInteractionEnabled = false guard let s = self else { return } if (isOn) { - s.tunnelsManager.startActivation(of: s.tunnel) { error in - print("Error while activating: \(String(describing: error))") + s.tunnelsManager.startActivation(of: s.tunnel) { [weak self] error in + if let error = error { + switch (error) { + case TunnelsManagerError.noEndpoint: + self?.showErrorAlert(title: "Endpoint missing", message: "There must be atleast one peer with an endpoint") + case TunnelsManagerError.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") + } + } } } else { s.tunnelsManager.startDeactivation(of: s.tunnel) { error in |