MapDecodingError
public enum MapDecodingError : Error, CustomStringConvertible
An error that is returned when attempting to return an object from a Map
.
-
Thrown when the key provided does not correspond to any value in the JSON dictionary.
Declaration
Swift
case valueNotFound(key: MapKey)
-
Thrown when the JSON object could not be decoded to the specified object for the given key. For example, you’re expecting the object to parse to a specific
MapCodable
object, but the JSON structure is not valid for that object. Can also be thrown for invalid enum types.Declaration
Swift
case failedToDecode(key: MapKey)
-
Thrown when the JSON value for the key provided is different from the expected type. For example if you’re expecting a
String
but the JSON dictionary contains anInt
.Declaration
Swift
case unexpectedType(key: MapKey)
-
Thrown when the key provided when trying to get a value from a map could not be parsed.
Declaration
Swift
case invalidKey(key: MapKey)
-
Declaration
Swift
public var description: String { get }