From 8f29f791685825d1e0928fcda716b79fb947b668 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Fri, 26 Oct 2018 10:49:37 +0200 Subject: [PATCH] Fix exceptions thrown on already migrated JSON Also remove deprecated tunnel configuration keys. --- .../Sources/Model/ConnectionService+Migration.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Passepartout/Sources/Model/ConnectionService+Migration.swift b/Passepartout/Sources/Model/ConnectionService+Migration.swift index a7483795..137a8766 100644 --- a/Passepartout/Sources/Model/ConnectionService+Migration.swift +++ b/Passepartout/Sources/Model/ConnectionService+Migration.swift @@ -58,7 +58,8 @@ extension ConnectionService { static func migrateToWrappedSessionConfiguration(_ json: inout [String: Any]) throws { guard let profiles = json["profiles"] as? [[String: Any]] else { - throw ApplicationError.migration + // migrated + return } var newProfiles: [[String: Any]] = [] for var container in profiles { @@ -83,6 +84,7 @@ extension ConnectionService { static func migrateToBaseConfiguration(_ json: inout [String: Any]) throws { guard var baseConfiguration = json["tunnelConfiguration"] as? [String: Any] else { + // migrated return } migrateSessionConfiguration(in: &baseConfiguration) @@ -124,5 +126,8 @@ extension ConnectionService { sessionConfiguration["renegotiatesAfter"] = value } map["sessionConfiguration"] = sessionConfiguration + + map.removeValue(forKey: "debugLogKey") + map.removeValue(forKey: "lastErrorKey") } }