aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-12-05 15:38:19 +0530
committerRoopesh Chander <roop@roopc.net>2018-12-07 12:36:19 +0530
commit7631844fbe6b578ac9b67d28c083c64b2db024d3 (patch)
tree4db13564bab6e25f735352ec11c496a056baf9d5 /WireGuard/WireGuard/UI/iOS
parentTunnel detail: Cell status switch should be toggled only after the alert presentation completes (diff)
downloadwireguard-apple-7631844fbe6b578ac9b67d28c083c64b2db024d3.tar.xz
wireguard-apple-7631844fbe6b578ac9b67d28c083c64b2db024d3.zip
Error presenter: Always handle the passed error
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS')
-rw-r--r--WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift7
1 files changed, 3 insertions, 4 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift b/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift
index 1116f61..2ae0cf0 100644
--- a/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift
+++ b/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift
@@ -5,7 +5,7 @@ import UIKit
import os.log
class ErrorPresenter {
- static func errorMessage(for error: Error) -> (String, String)? {
+ static func errorMessage(for error: Error) -> (String, String) {
switch (error) {
// TunnelManagementError
@@ -43,15 +43,14 @@ class ErrorPresenter {
return ("Nothing to export", "There are no tunnels to export")
default:
- os_log("ErrorPresenter: Error not presented: %{public}@", log: OSLog.default, type: .error, "\(error)")
- return nil
+ return ("Error", error.localizedDescription)
}
}
static func showErrorAlert(error: Error, from sourceVC: UIViewController?,
onDismissal: (() -> Void)? = nil, onPresented: (() -> Void)? = nil) {
guard let sourceVC = sourceVC else { return }
- guard let (title, message) = ErrorPresenter.errorMessage(for: error) else { return }
+ let (title, message) = ErrorPresenter.errorMessage(for: error)
let okAction = UIAlertAction(title: "OK", style: .default) { (_) in
onDismissal?()
}