From 89d9809b9ebb164c7241ea8f386aa4dbf18ed1c8 Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Fri, 23 Sep 2022 18:34:19 -0400 Subject: [PATCH 1/2] add error description to JSONErrors --- MVMCore/MVMCore/Models/JSON/JSONHelper.swift | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/MVMCore/MVMCore/Models/JSON/JSONHelper.swift b/MVMCore/MVMCore/Models/JSON/JSONHelper.swift index a0c20d0..775048d 100644 --- a/MVMCore/MVMCore/Models/JSON/JSONHelper.swift +++ b/MVMCore/MVMCore/Models/JSON/JSONHelper.swift @@ -18,6 +18,30 @@ public enum JSONError: Error { case error(message: String) } +extension JSONError: LocalizedError, CustomStringConvertible { + + public var description: String { + switch self { + case .pathNotFound: + return "JSON path not found" + case .data(path: let path): + return "JSON data in \(path) is corrupt" + case .other(error: let error): + if let decodingError = error as? DecodingError { + // the only way to get the decoding error description and details... + return (decodingError as NSError).description + } + return error.localizedDescription + case .error(message: let message): + return message + } + } + + public var errorDescription: String? { + return description + } +} + extension JSONDictionary { public func toJSONString(options: JSONSerialization.WritingOptions = []) throws -> String { From de280960f7fcb53bd31c92e6bed24b7abfe05f10 Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Mon, 3 Oct 2022 11:32:49 -0400 Subject: [PATCH 2/2] copy over the actionMap to the new object for presentationStyle resolution fix. --- MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m | 1 + 1 file changed, 1 insertion(+) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m b/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m index 63f4f4f..e07070a 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreRequestParameters.m @@ -152,6 +152,7 @@ copyObject.customTimeoutTime = self.customTimeoutTime; copyObject.backgroundRequest = self.backgroundRequest; copyObject.URL = self.URL; + copyObject.actionMap = self.actionMap; return copyObject; }