diff --git a/Passepartout/Sources/ApplicationError.swift b/Passepartout/Sources/ApplicationError.swift index d99bf98a..fe26d9e6 100644 --- a/Passepartout/Sources/ApplicationError.swift +++ b/Passepartout/Sources/ApplicationError.swift @@ -30,12 +30,6 @@ enum ApplicationError: Error { case missingCredentials - case providerPool - - case providerPreset - - case hostEndpoints - case missingCA case emptyRemotes diff --git a/Passepartout/Sources/Model/Profiles/HostConnectionProfile.swift b/Passepartout/Sources/Model/Profiles/HostConnectionProfile.swift index 130cb08a..0e683e0c 100644 --- a/Passepartout/Sources/Model/Profiles/HostConnectionProfile.swift +++ b/Passepartout/Sources/Model/Profiles/HostConnectionProfile.swift @@ -52,9 +52,7 @@ class HostConnectionProfile: ConnectionProfile, Codable, Equatable { } func generate(from configuration: TunnelKitProvider.Configuration, preferences: Preferences) throws -> TunnelKitProvider.Configuration { - guard !parameters.endpointProtocols.isEmpty else { - throw ApplicationError.hostEndpoints - } + precondition(!parameters.endpointProtocols.isEmpty) // XXX: copy paste, error prone var builder = parameters.builder() diff --git a/Passepartout/Sources/Model/Profiles/ProviderConnectionProfile.swift b/Passepartout/Sources/Model/Profiles/ProviderConnectionProfile.swift index 22c28c9b..7e86c93c 100644 --- a/Passepartout/Sources/Model/Profiles/ProviderConnectionProfile.swift +++ b/Passepartout/Sources/Model/Profiles/ProviderConnectionProfile.swift @@ -40,7 +40,7 @@ class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable { } var pool: Pool? { - return infrastructure.pool(for: poolId) + return infrastructure.pool(for: poolId) ?? infrastructure.pool(for: infrastructure.defaults.pool) } var presetId: String { @@ -107,10 +107,10 @@ class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable { func generate(from configuration: TunnelKitProvider.Configuration, preferences: Preferences) throws -> TunnelKitProvider.Configuration { guard let pool = pool else { - throw ApplicationError.providerPool + preconditionFailure("Nil pool?") } guard let preset = preset else { - throw ApplicationError.providerPreset + preconditionFailure("Nil preset?") } // assert(!pool.numericAddresses.isEmpty)