Fix description of parsing errors on import (#623)

Fixes #607
This commit is contained in:
Davide 2024-09-28 00:01:01 +02:00 committed by GitHub
parent fbc6ece59d
commit 989886c434
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 80 additions and 3 deletions

View File

@ -0,0 +1,76 @@
{
"pins" : [
{
"identity" : "dtfoundation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Cocoanetics/DTFoundation.git",
"state" : {
"revision" : "76062513434421cb6c8a1ae1d4f8368a7ebc2da3",
"version" : "1.7.18"
}
},
{
"identity" : "kvitto",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Cocoanetics/Kvitto",
"state" : {
"revision" : "88888674d772ddcf19671159ed0022cb0bc37be2",
"version" : "1.0.6"
}
},
{
"identity" : "openssl-apple",
"kind" : "remoteSourceControl",
"location" : "https://github.com/passepartoutvpn/openssl-apple",
"state" : {
"revision" : "0edc07c7a0e4ec2ca0f448dd68314241ccc925b3",
"version" : "3.2.107"
}
},
{
"identity" : "passepartoutkit",
"kind" : "remoteSourceControl",
"location" : "git@github.com:passepartoutvpn/passepartoutkit",
"state" : {
"revision" : "ed3f54281b672af0f1127f00033579a36a9afed5"
}
},
{
"identity" : "passepartoutkit-openvpn-openssl",
"kind" : "remoteSourceControl",
"location" : "git@github.com:passepartoutvpn/passepartoutkit-openvpn-openssl",
"state" : {
"revision" : "a3092a6ee0a63f666aa47ef3f0f50c324a64598d",
"version" : "0.6.0"
}
},
{
"identity" : "passepartoutkit-wireguard-go",
"kind" : "remoteSourceControl",
"location" : "git@github.com:passepartoutvpn/passepartoutkit-wireguard-go",
"state" : {
"revision" : "2cbd6023300d2dcc3f6f68de4812cf390421ec35",
"version" : "0.6.2"
}
},
{
"identity" : "wg-go-apple",
"kind" : "remoteSourceControl",
"location" : "https://github.com/passepartoutvpn/wg-go-apple",
"state" : {
"revision" : "860e82efaf261da37483a5f51555be83e5a79ad3",
"version" : "0.0.20240714"
}
},
{
"identity" : "wireguard-apple",
"kind" : "remoteSourceControl",
"location" : "https://github.com/passepartoutvpn/wireguard-apple",
"state" : {
"revision" : "a896f784bc5ed94f29d97e376be5cfa08d4a5d44",
"version" : "1.1.1"
}
}
],
"version" : 2
}

View File

@ -31,7 +31,7 @@ let package = Package(
], ],
dependencies: [ dependencies: [
// .package(url: "git@github.com:passepartoutvpn/passepartoutkit", from: "0.7.0"), // .package(url: "git@github.com:passepartoutvpn/passepartoutkit", from: "0.7.0"),
.package(url: "git@github.com:passepartoutvpn/passepartoutkit", revision: "2d7e0210d8754664ce45528d50c1a1e6a36ad27c"), .package(url: "git@github.com:passepartoutvpn/passepartoutkit", revision: "ed3f54281b672af0f1127f00033579a36a9afed5"),
// .package(path: "../../../passepartoutkit"), // .package(path: "../../../passepartoutkit"),
.package(url: "git@github.com:passepartoutvpn/passepartoutkit-openvpn-openssl", from: "0.6.0"), .package(url: "git@github.com:passepartoutvpn/passepartoutkit-openvpn-openssl", from: "0.6.0"),
// .package(path: "../../../passepartoutkit-openvpn-openssl"), // .package(path: "../../../passepartoutkit-openvpn-openssl"),

View File

@ -60,7 +60,8 @@ final class ProfileImporter: ObservableObject {
) )
} catch { } catch {
if let error = error as? PassepartoutError, if let error = error as? PassepartoutError,
error.code == .OpenVPN.passphraseRequired { let reason = error.reason as? PassepartoutError,
reason.code == .OpenVPN.passphraseRequired {
withPassphrase.append(url) withPassphrase.append(url)
continue continue
} }

View File

@ -71,7 +71,7 @@ extension PassepartoutError: LocalizedError {
return Strings.Errors.App.Passepartout.invalidFields(fieldsDescription) return Strings.Errors.App.Passepartout.invalidFields(fieldsDescription)
case .parsing: case .parsing:
return Strings.Errors.App.Passepartout.parsing return reason?.localizedDescription ?? Strings.Errors.App.Passepartout.parsing
case .unhandled: case .unhandled:
return reason?.localizedDescription return reason?.localizedDescription