PR Review comments fixed.

This commit is contained in:
Danish Phiroz 2024-10-23 11:17:48 -04:00
parent fe12f6855d
commit 0fd00d05db
2 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@ public struct ModelRegistry {
case decoderOther(message: String)
case decoderErrorObjectNotPresent(codingKey: CodingKey, codingPath: [CodingKey])
case decoderErrorModelNotMapped(identifer: String? = nil, codingKey: CodingKey? = nil, codingPath: [CodingKey]? = nil)
case decoderErrorUnexpectedType(actualType: String? = nil, expectedType: String? = nil, identifer: String? = nil, codingKey: CodingKey? = nil, codingPath: [CodingKey]? = nil)
case decoderErrorUnexpectedType(actualType: String, expectedType: String, identifer: String, codingKey: CodingKey? = nil, codingPath: [CodingKey]? = nil)
case duplicateRegistration(message: String)
case other(message: String)
case handlerNotMapped(identifer: String? = nil, categoryName: String? = nil)

View File

@ -32,8 +32,8 @@ extension ModelRegistry.Error: HumanReadableDecodingErrorProtocol {
case .decoderErrorModelNotMapped(let identifier, let codingKey, let codingPath) where identifier != nil && codingKey != nil && codingPath != nil:
return "Model identifier \"\(identifier!)\" is not mapped for \"\(codingKey!.stringValue)\" @ \(codingPath!.map { return $0.stringValue })"
case .decoderErrorUnexpectedType(let actualType, let expectedType, let identifier, let codingKey, let codingPath) where actualType != nil && expectedType != nil && identifier != nil && codingKey != nil && codingPath != nil:
return "Model identifier \"\(identifier!)\" has unexpected type \"\(actualType!)\" expected type \"\(expectedType!)\" for \"\(codingKey!.stringValue)\" @ \(codingPath!.map { return $0.stringValue })"
case .decoderErrorUnexpectedType(let actualType, let expectedType, let identifier, let codingKey, let codingPath) where codingKey != nil && codingPath != nil:
return "Model identifier \"\(identifier)\" has unexpected type \"\(actualType)\" expected type \"\(expectedType)\" for \"\(codingKey!.stringValue)\" @ \(codingPath!.map { return $0.stringValue })"
case .decoderErrorObjectNotPresent(let codingKey, let codingPath):
return "Required model \"\(codingKey.stringValue)\" was not found @ \(codingPath.map { return $0.stringValue })"