mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
Fixes missing last Coding Path value for DecodingError.keyNotFound
This commit is contained in:
@@ -136,7 +136,13 @@ final class FetchSourceOperation: ResultOperation<Source>
|
|||||||
catch let error as DecodingError
|
catch let error as DecodingError
|
||||||
{
|
{
|
||||||
let nsError = error as NSError
|
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 rawComponents = codingPath.map { $0.intValue?.description ?? $0.stringValue }
|
||||||
let pathDescription = rawComponents.joined(separator: " > ")
|
let pathDescription = rawComponents.joined(separator: " > ")
|
||||||
|
|||||||
Reference in New Issue
Block a user