Skip to content

Commit

Permalink
lastDisconnectError now matches against NEVPNConnectionError (#2753)
Browse files Browse the repository at this point in the history
  • Loading branch information
quanganhdo authored Apr 22, 2024
1 parent 9f31083 commit 09fbfc0
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions DuckDuckGo/Feedback/VPNMetadataCollector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -237,18 +237,29 @@ final class DefaultVPNMetadataCollector: VPNMetadataCollector {
tunnelManager.connection.fetchLastDisconnectError { error in
let message = {
if let error = error as? NSError {
if error.domain == NEVPNConnectionErrorDomain, let code = NEDNSSettingsManagerError(rawValue: error.code) {
if error.domain == NEVPNConnectionErrorDomain,
let code = NEVPNConnectionError(rawValue: error.code) {
switch code {
case .configurationCannotBeRemoved:
return "configurationCannotBeRemoved"
case .configurationDisabled:
return "configurationDisabled"
case .configurationInvalid:
return "configurationInvalid"
case .configurationStale:
return "configurationStale"
default:
return error.localizedDescription
case .overslept: return "overslept"
case .noNetworkAvailable: return "noNetworkAvailable"
case .unrecoverableNetworkChange: return "unrecoverableNetworkChange"
case .configurationFailed: return "configurationFailed"
case .serverAddressResolutionFailed: return "serverAddressResolutionFailed"
case .serverNotResponding: return "serverNotResponding"
case .serverDead: return "serverDead"
case .authenticationFailed: return "authenticationFailed"
case .clientCertificateInvalid: return "clientCertificateInvalid"
case .clientCertificateNotYetValid: return "clientCertificateNotYetValid"
case .clientCertificateExpired: return "clientCertificateExpired"
case .pluginFailed: return "pluginFailed"
case .configurationNotFound: return "configurationNotFound"
case .pluginDisabled: return "pluginDisabled"
case .negotiationFailed: return "negotiationFailed"
case .serverDisconnected: return "serverDisconnected"
case .serverCertificateInvalid: return "serverCertificateInvalid"
case .serverCertificateNotYetValid: return "serverCertificateNotYetValid"
case .serverCertificateExpired: return "serverCertificateExpired"
default: return error.localizedDescription
}
} else {
return error.localizedDescription
Expand Down

0 comments on commit 09fbfc0

Please sign in to comment.