TunnelsManager: Better errors
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
@@ -15,8 +15,8 @@ protocol TunnelsManagerDelegate: class {
|
|||||||
enum TunnelActivationError: Error {
|
enum TunnelActivationError: Error {
|
||||||
case noEndpoint
|
case noEndpoint
|
||||||
case dnsResolutionFailed
|
case dnsResolutionFailed
|
||||||
case tunnelOperationFailed
|
case tunnelActivationFailed
|
||||||
case attemptingActivationWhenAnotherTunnelIsActive
|
case attemptingActivationWhenAnotherTunnelIsBusy(otherTunnelStatus: TunnelStatus)
|
||||||
case attemptingActivationWhenTunnelIsNotInactive
|
case attemptingActivationWhenTunnelIsNotInactive
|
||||||
case attemptingDeactivationWhenTunnelIsInactive
|
case attemptingDeactivationWhenTunnelIsInactive
|
||||||
}
|
}
|
||||||
@@ -237,7 +237,7 @@ class TunnelsManager {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
guard (currentTunnel == nil) else {
|
guard (currentTunnel == nil) else {
|
||||||
completionHandler(TunnelActivationError.attemptingActivationWhenAnotherTunnelIsActive)
|
completionHandler(TunnelActivationError.attemptingActivationWhenAnotherTunnelIsBusy(otherTunnelStatus: currentTunnel!.status))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setCurrentTunnel(tunnel: tunnel)
|
setCurrentTunnel(tunnel: tunnel)
|
||||||
@@ -368,7 +368,7 @@ class TunnelContainer: NSObject {
|
|||||||
completionHandler: @escaping (Error?) -> Void) {
|
completionHandler: @escaping (Error?) -> Void) {
|
||||||
if (recursionCount >= 8) {
|
if (recursionCount >= 8) {
|
||||||
os_log("startActivation: Failed after 8 attempts. Giving up with %{public}@.", log: OSLog.default, type: .error, "\(lastError!)")
|
os_log("startActivation: Failed after 8 attempts. Giving up with %{public}@.", log: OSLog.default, type: .error, "\(lastError!)")
|
||||||
completionHandler(lastError)
|
completionHandler(TunnelActivationError.tunnelActivationFailed)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user