Tunnel errors: Consolidate tunnel activation errors into ErrorPresenter
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user