aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/MainViewController.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-12-06 15:58:27 +0530
committerRoopesh Chander <roop@roopc.net>2018-12-07 12:36:19 +0530
commit8d26a3c5360a89605b2ecf6c5ad8edadd8eea590 (patch)
tree52f570268e04f8df77790dcfab40a560fa0d9df6 /WireGuard/WireGuard/UI/iOS/MainViewController.swift
parentError presenter: Always handle the passed error (diff)
downloadwireguard-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/MainViewController.swift10
1 files changed, 7 insertions, 3 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/MainViewController.swift b/WireGuard/WireGuard/UI/iOS/MainViewController.swift
index 18853d9..0d2d681 100644
--- a/WireGuard/WireGuard/UI/iOS/MainViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/MainViewController.swift
@@ -36,8 +36,12 @@ class MainViewController: UISplitViewController {
self.preferredDisplayMode = .allVisible
// Create the tunnels manager, and when it's ready, inform tunnelsListVC
- TunnelsManager.create { [weak self] tunnelsManager in
- guard let tunnelsManager = tunnelsManager else { return }
+ TunnelsManager.create { [weak self] result in
+ if let error = result.error {
+ ErrorPresenter.showErrorAlert(error: error, from: self)
+ return
+ }
+ let tunnelsManager: TunnelsManager = result.value!
guard let s = self else { return }
s.tunnelsManager = tunnelsManager
@@ -52,7 +56,7 @@ class MainViewController: UISplitViewController {
}
extension MainViewController: TunnelsManagerActivationDelegate {
- func tunnelActivationFailed(tunnel: TunnelContainer, error: TunnelActivationError) {
+ func tunnelActivationFailed(tunnel: TunnelContainer, error: TunnelsManagerError) {
ErrorPresenter.showErrorAlert(error: error, from: self)
}
}