VPN: Better error messages

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander
2018-10-30 00:24:50 +05:30
parent 4cacf550a3
commit 38e4e274aa
3 changed files with 27 additions and 5 deletions
@@ -232,7 +232,16 @@ extension TunnelsListTableViewController {
guard let s = self, let tunnelsManager = s.tunnelsManager else { return }
if (isOn) {
tunnelsManager.startActivation(of: tunnel) { error in
print("Error while activating: \(String(describing: error))")
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 {
tunnelsManager.startDeactivation(of: tunnel) { error in