VPN: TunnelsManager: s/TunnelsManagerError/TunnelActivationError/g;

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2018-10-31 23:37:46 +05:30
parent 0aab067a53
commit dd33d74caf
3 changed files with 10 additions and 10 deletions

View File

@ -152,9 +152,9 @@ extension TunnelDetailTableViewController {
s.tunnelsManager.startActivation(of: s.tunnel) { [weak self] error in
if let error = error {
switch (error) {
case TunnelsManagerError.noEndpoint:
case TunnelActivationError.noEndpoint:
self?.showErrorAlert(title: "Endpoint missing", message: "There must be at least one peer with an endpoint")
case TunnelsManagerError.dnsResolutionFailed:
case TunnelActivationError.dnsResolutionFailed:
self?.showErrorAlert(title: "DNS Failure", message: "One or more endpoint domains could not be resolved")
default:
self?.showErrorAlert(title: "Internal error", message: "The tunnel could not be activated")

View File

@ -246,9 +246,9 @@ extension TunnelsListTableViewController {
tunnelsManager.startActivation(of: tunnel) { error in
if let error = error {
switch (error) {
case TunnelsManagerError.noEndpoint:
case TunnelActivationError.noEndpoint:
self?.showErrorAlert(title: "Endpoint missing", message: "There must be at least one peer with an endpoint")
case TunnelsManagerError.dnsResolutionFailed:
case TunnelActivationError.dnsResolutionFailed:
self?.showErrorAlert(title: "DNS Failure", message: "One or more endpoint domains could not be resolved")
default:
self?.showErrorAlert(title: "Internal error", message: "The tunnel could not be activated")

View File

@ -12,7 +12,7 @@ protocol TunnelsManagerDelegate: class {
func tunnelRemoved(at: Int)
}
enum TunnelsManagerError: Error {
enum TunnelActivationError: Error {
case noEndpoint
case dnsResolutionFailed
case tunnelOperationFailed
@ -210,11 +210,11 @@ class TunnelsManager {
func startActivation(of tunnel: TunnelContainer, completionHandler: @escaping (Error?) -> Void) {
guard (tunnel.status == .inactive) else {
completionHandler(TunnelsManagerError.attemptingActivationWhenTunnelIsNotInactive)
completionHandler(TunnelActivationError.attemptingActivationWhenTunnelIsNotInactive)
return
}
guard (currentTunnel == nil) else {
completionHandler(TunnelsManagerError.attemptingActivationWhenAnotherTunnelIsActive)
completionHandler(TunnelActivationError.attemptingActivationWhenAnotherTunnelIsActive)
return
}
tunnel.startActivation(completionHandler: completionHandler)
@ -223,7 +223,7 @@ class TunnelsManager {
func startDeactivation(of tunnel: TunnelContainer, completionHandler: @escaping (Error?) -> Void) {
if (tunnel.status == .inactive) {
completionHandler(TunnelsManagerError.attemptingDeactivationWhenTunnelIsInactive)
completionHandler(TunnelActivationError.attemptingDeactivationWhenTunnelIsInactive)
return
}
assert(tunnel.index == currentTunnel!.index)
@ -305,7 +305,7 @@ class TunnelContainer: NSObject {
guard (endpoints.contains(where: { $0 != nil })) else {
DispatchQueue.main.async { [weak self] in
self?.status = .inactive
completionHandler(TunnelsManagerError.noEndpoint)
completionHandler(TunnelActivationError.noEndpoint)
}
return
}
@ -328,7 +328,7 @@ class TunnelContainer: NSObject {
s.dnsResolver = nil
guard let resolvedEndpoints = resolvedEndpoints else {
s.status = .inactive
completionHandler(TunnelsManagerError.dnsResolutionFailed)
completionHandler(TunnelActivationError.dnsResolutionFailed)
return
}
s.startActivation(tunnelConfiguration: tunnelConfiguration,