diff --git a/Sources/LCEssentials/Extensions/LCEssentials+EncodableDecodable.swift b/Sources/LCEssentials/Extensions/LCEssentials+EncodableDecodable.swift index f72313b..5059b74 100644 --- a/Sources/LCEssentials/Extensions/LCEssentials+EncodableDecodable.swift +++ b/Sources/LCEssentials/Extensions/LCEssentials+EncodableDecodable.swift @@ -58,7 +58,8 @@ extension JSONDecoder { let msg = "Type mismatch for type '\(type)' \(T.self) Object: \(context.debugDescription)" error = NSError.createErrorWith(code: 0, description: msg, reasonForError: msg) } catch let DecodingError.valueNotFound(value, context) { - let msg = "Missing value '\(value)' in \(T.self) Object in JSON: \(context.debugDescription)" + let key = context.codingPath.last?.stringValue ?? "unknown_key" + let msg = "Missing value '\(value)' for key '\(key)' in \(T.self) Object in JSON: \(context.debugDescription)" error = NSError.createErrorWith(code: 0, description: msg, reasonForError: msg) } catch { throw error