diff --git a/Passepartout/Sources/ApplicationError.swift b/Passepartout/Sources/ApplicationError.swift index 569ad082..37b49833 100644 --- a/Passepartout/Sources/ApplicationError.swift +++ b/Passepartout/Sources/ApplicationError.swift @@ -31,4 +31,6 @@ enum ApplicationError: String, Error { case missingCredentials case migration + + case inactiveProfile } diff --git a/Passepartout/Sources/VPN/GracefulVPN.swift b/Passepartout/Sources/VPN/GracefulVPN.swift index 4e92b511..73d96217 100644 --- a/Passepartout/Sources/VPN/GracefulVPN.swift +++ b/Passepartout/Sources/VPN/GracefulVPN.swift @@ -28,8 +28,6 @@ import SwiftyBeaver private let log = SwiftyBeaver.self -// FIXME: replace completionHandler?(nil) with completionHandler?(some_error) - class GracefulVPN { private let service: ConnectionService @@ -70,7 +68,7 @@ class GracefulVPN { func reconnect(completionHandler: ((Error?) -> Void)?) { service.clearVpnLastError() guard let vpn = vpn else { - completionHandler?(nil) + completionHandler?(ApplicationError.inactiveProfile) return } do { @@ -84,7 +82,7 @@ class GracefulVPN { func reinstall(completionHandler: ((Error?) -> Void)?) { service.clearVpnLastError() guard let vpn = vpn else { - completionHandler?(nil) + completionHandler?(ApplicationError.inactiveProfile) return } do { @@ -109,7 +107,7 @@ class GracefulVPN { func disconnect(completionHandler: ((Error?) -> Void)?) { guard let vpn = vpn else { - completionHandler?(nil) + completionHandler?(ApplicationError.inactiveProfile) return } vpn.disconnect(completionHandler: completionHandler)