From c86e00413b0483abb0e1b04d1d1a5573d9d8985f Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Thu, 15 Feb 2024 18:40:51 -0600 Subject: [PATCH] Fixes missing last Coding Path value for DecodingError.keyNotFound --- AltStore/Operations/FetchSourceOperation.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/AltStore/Operations/FetchSourceOperation.swift b/AltStore/Operations/FetchSourceOperation.swift index d03104e9..1571fbe8 100644 --- a/AltStore/Operations/FetchSourceOperation.swift +++ b/AltStore/Operations/FetchSourceOperation.swift @@ -136,7 +136,13 @@ final class FetchSourceOperation: ResultOperation catch let error as DecodingError { let nsError = error as NSError - guard let codingPath = nsError.userInfo[ALTNSCodingPathKey] as? [CodingKey] else { throw error } + guard var codingPath = nsError.userInfo[ALTNSCodingPathKey] as? [CodingKey] else { throw error } + + if case .keyNotFound(let key, _) = error + { + // Add missing key to error for better debugging. + codingPath.append(key) + } let rawComponents = codingPath.map { $0.intValue?.description ?? $0.stringValue } let pathDescription = rawComponents.joined(separator: " > ")