An error that occurs during the decoding of a value.
SDK
- Xcode 9.0+
Framework
- Swift Standard Library
Declaration
enum DecodingError
An error that occurs during the decoding of a value.
SDK
Framework
enum DecodingError
case data Corrupted(Decoding Error .Context)An indication that the data is corrupted or otherwise invalid.
case key Not Found(Coding Key, Decoding Error .Context)An indication that a keyed decoding container was asked for an entry for the given key, but did not contain one.
case type Mismatch(Any .Type, Decoding Error .Context)An indication that a value of the given type could not be decoded because it did not match the type of what was found in the encoded payload.
case value Not Found(Any .Type, Decoding Error .Context)An indication that a non-optional value of the given type was expected, but a null value was found.
static func data Corrupted Error<C>(for Key: C .Key, in: C, debug Description: String) -> Decoding ErrorReturns a new .data error using a constructed coding path and the given debug description.
static func data Corrupted Error(in: Single Value Decoding Container, debug Description: String) -> Decoding ErrorReturns a new .data error using a constructed coding path and the given debug description.
static func data Corrupted Error(in: Unkeyed Decoding Container, debug Description: String) -> Decoding ErrorReturns a new .data error using a constructed coding path and the given debug description.
struct Decoding Error .ContextThe context in which the error occurred.
protocol EncoderA type that can encode values into a native format for external representation.
protocol DecoderA type that can decode values from a native format into in-memory representations.
enum Encoding ErrorAn error that occurs during the encoding of a value.