diff options
author | Roopesh Chander <roop@roopc.net> | 2018-12-06 15:58:27 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2018-12-07 12:36:19 +0530 |
commit | 8d26a3c5360a89605b2ecf6c5ad8edadd8eea590 (patch) | |
tree | 52f570268e04f8df77790dcfab40a560fa0d9df6 /WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift | |
parent | Error presenter: Always handle the passed error (diff) | |
download | wireguard-apple-8d26a3c5360a89605b2ecf6c5ad8edadd8eea590.tar.xz wireguard-apple-8d26a3c5360a89605b2ecf6c5ad8edadd8eea590.zip |
Error handling: Cleanup Tunnels Manager errors
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to '')
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift index 74c6e57..ca5e6a8 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift @@ -99,14 +99,13 @@ class TunnelEditTableViewController: UITableViewController { } else { // We're adding a new tunnel tunnelsManager.add(tunnelConfiguration: tunnelConfiguration, - activateOnDemandSetting: activateOnDemandSetting) { [weak self] (tunnel, error) in - if let error = error { + activateOnDemandSetting: activateOnDemandSetting) { [weak self] result in + if let error = result.error { ErrorPresenter.showErrorAlert(error: error, from: self) } else { + let tunnel: TunnelContainer = result.value! self?.dismiss(animated: true, completion: nil) - if let tunnel = tunnel { - self?.delegate?.tunnelSaved(tunnel: tunnel) - } + self?.delegate?.tunnelSaved(tunnel: tunnel) } } } |