]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
TunnelsManager: Better errors
authorRoopesh Chander <roop@roopc.net>
Thu, 1 Nov 2018 11:27:40 +0000 (16:57 +0530)
committerRoopesh Chander <roop@roopc.net>
Thu, 1 Nov 2018 11:27:40 +0000 (16:57 +0530)
Signed-off-by: Roopesh Chander <roop@roopc.net>
WireGuard/WireGuard/VPN/TunnelsManager.swift

index 7c942adbec699005484de208460b48bc5337d011..7d5dd50ce4efb46a0b245e48a2690e9de74cb92a 100644 (file)
@@ -15,8 +15,8 @@ protocol TunnelsManagerDelegate: class {
 enum TunnelActivationError: Error {
     case noEndpoint
     case dnsResolutionFailed
-    case tunnelOperationFailed
-    case attemptingActivationWhenAnotherTunnelIsActive
+    case tunnelActivationFailed
+    case attemptingActivationWhenAnotherTunnelIsBusy(otherTunnelStatus: TunnelStatus)
     case attemptingActivationWhenTunnelIsNotInactive
     case attemptingDeactivationWhenTunnelIsInactive
 }
@@ -237,7 +237,7 @@ class TunnelsManager {
             return
         }
         guard (currentTunnel == nil) else {
-            completionHandler(TunnelActivationError.attemptingActivationWhenAnotherTunnelIsActive)
+            completionHandler(TunnelActivationError.attemptingActivationWhenAnotherTunnelIsBusy(otherTunnelStatus: currentTunnel!.status))
             return
         }
         setCurrentTunnel(tunnel: tunnel)
@@ -368,7 +368,7 @@ class TunnelContainer: NSObject {
                                      completionHandler: @escaping (Error?) -> Void) {
         if (recursionCount >= 8) {
             os_log("startActivation: Failed after 8 attempts. Giving up with %{public}@.", log: OSLog.default, type: .error, "\(lastError!)")
-            completionHandler(lastError)
+            completionHandler(TunnelActivationError.tunnelActivationFailed)
             return
         }