aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.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/TunnelsListTableViewController.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 'WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift')
-rw-r--r--WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift8
1 files changed, 4 insertions, 4 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
index 3cc3fa1..ae39587 100644
--- a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
@@ -182,8 +182,8 @@ class TunnelsListTableViewController: UIViewController {
let fileBaseName = url.deletingPathExtension().lastPathComponent.trimmingCharacters(in: .whitespacesAndNewlines)
if let fileContents = try? String(contentsOf: url),
let tunnelConfiguration = try? WgQuickConfigFileParser.parse(fileContents, name: fileBaseName) {
- tunnelsManager.add(tunnelConfiguration: tunnelConfiguration) { (_, error) in
- if let error = error {
+ tunnelsManager.add(tunnelConfiguration: tunnelConfiguration) { [weak self] result in
+ if let error = result.error {
ErrorPresenter.showErrorAlert(error: error, from: self)
}
}
@@ -207,8 +207,8 @@ extension TunnelsListTableViewController: UIDocumentPickerDelegate {
extension TunnelsListTableViewController: QRScanViewControllerDelegate {
func addScannedQRCode(tunnelConfiguration: TunnelConfiguration, qrScanViewController: QRScanViewController,
completionHandler: (() -> Void)?) {
- tunnelsManager?.add(tunnelConfiguration: tunnelConfiguration) { (_, error) in
- if let error = error {
+ tunnelsManager?.add(tunnelConfiguration: tunnelConfiguration) { result in
+ if let error = result.error {
ErrorPresenter.showErrorAlert(error: error, from: qrScanViewController, onDismissal: completionHandler)
} else {
completionHandler?()