aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-10-30 00:24:50 +0530
committerRoopesh Chander <roop@roopc.net>2018-10-30 00:24:50 +0530
commit38e4e274aa402788ce89294aece498a2c742f231 (patch)
tree480e94191d81bfbdb5c73ec5a7d1b287bcf0cf58 /WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift
parentVPN: Specify an error when there are no peers with an endpoint (diff)
downloadwireguard-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.swift14
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