Fix wording of root key decoding error

This commit is contained in:
Gwendal Roué committed 2020-09-19 15:52:50 +02:00
1 parent 6348c6f151
commit 5050c36c4e
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -204,7 +204,7 @@ private struct _RowDecoder<R: FetchableRecord>: Decoder {
let keys = [decodedRootKey.stringValue, key.stringValue].sorted()
throw DecodingError.keyNotFound(key, DecodingError.Context(
codingPath: codingPath,
debugDescription: "Missing key: \(keys.joined(separator: " or "))"))
debugDescription: "No such key: \(keys.joined(separator: " or "))"))
} else {
decodedRootKey = key
return try decode(type, fromRow: row, codingPath: codingPath + [key])
@@ -1106,7 +1106,7 @@ extension FetchableRecordDecodableTests {
XCTFail("Expected error")
} catch let DecodingError.keyNotFound(key, context) {
XCTAssert(["b", "c"].contains(key.stringValue))
XCTAssertEqual(context.debugDescription, "Missing key: b or c")
XCTAssertEqual(context.debugDescription, "No such key: b or c")
}
do {
// - b is present
@@ -1116,7 +1116,7 @@ extension FetchableRecordDecodableTests {
XCTFail("Expected error")
} catch let DecodingError.keyNotFound(key, context) {
XCTAssert(["a", "c"].contains(key.stringValue))
XCTAssertEqual(context.debugDescription, "Missing key: a or c")
XCTAssertEqual(context.debugDescription, "No such key: a or c")
}
do {
// - c is present
@@ -1126,7 +1126,7 @@ extension FetchableRecordDecodableTests {
XCTFail("Expected error")
} catch let DecodingError.keyNotFound(key, context) {
XCTAssert(["a", "b"].contains(key.stringValue))
XCTAssertEqual(context.debugDescription, "Missing key: a or b")
XCTAssertEqual(context.debugDescription, "No such key: a or b")
}
}
}