@@ -18,24 +18,24 @@ import Combine
1818import Foundation
1919
2020/// Errors from `DictionaryDecoder`
21- public enum DictionaryDecoderError : LocalizedError {
21+ public enum DictionaryDecoderError : LocalizedError , Sendable {
2222 /// The dictionary value could not be decoded to the expected type.
23- case typeMismatch( expected: Any . Type , actual: Any , codingPath: [ CodingKey ] )
23+ case typeMismatch( expected: String , actual: String , codingPath: [ String ] )
2424 /// A required key was not found in the dictionary.
25- case keyNotFound( CodingKey , codingPath: [ CodingKey ] )
25+ case keyNotFound( String , codingPath: [ String ] )
2626 /// The value was null or missing when a non-optional was expected.
27- case valueNotFound( Any . Type , codingPath: [ CodingKey ] )
27+ case valueNotFound( String , codingPath: [ String ] )
2828
2929 public var errorDescription : String ? {
3030 switch self {
3131 case let . typeMismatch( expected, actual, codingPath) :
32- let path = codingPath. map ( \ . stringValue ) . joined ( separator: " . " )
33- return " Type mismatch at ' \( path) ': expected \( expected) but found \( type ( of : actual) ) . "
32+ let path = codingPath. joined ( separator: " . " )
33+ return " Type mismatch at ' \( path) ': expected \( expected) but found \( actual) . "
3434 case let . keyNotFound( key, codingPath) :
35- let path = codingPath. map ( \ . stringValue ) . joined ( separator: " . " )
36- return " Key ' \( key. stringValue ) ' not found at ' \( path) '. "
35+ let path = codingPath. joined ( separator: " . " )
36+ return " Key ' \( key) ' not found at ' \( path) '. "
3737 case let . valueNotFound( type, codingPath) :
38- let path = codingPath. map ( \ . stringValue ) . joined ( separator: " . " )
38+ let path = codingPath. joined ( separator: " . " )
3939 return " Value of type \( type) not found at ' \( path) '. "
4040 }
4141 }
0 commit comments