this repo has no description
at main 42 lines 1.4 kB view raw
1// 2// DecodingError+Context+Predefined.swift 3// URLQueryItemCoder 4// 5// Created by Kyle Hughes on 2/26/23. 6// 7 8extension DecodingError.Context { 9 // MARK: Internal Instance Interface 10 11 @inlinable 12 internal static func foundNilInsteadOfPrimitiveValue(at codingPath: [any CodingKey]) -> Self { 13 DecodingError.Context( 14 codingPath: codingPath, 15 debugDescription: "Cannot decode primitive value – found nil value instead." 16 ) 17 } 18 19 @inlinable 20 internal static func noValueAssociatedWithKey(at codingPath: [any CodingKey]) -> Self { 21 DecodingError.Context( 22 codingPath: codingPath, 23 debugDescription: "No value associated with with key." 24 ) 25 } 26 27 @inlinable 28 internal static func primitiveValueMismatch(at codingPath: [any CodingKey], for type: Any.Type) -> Self { 29 DecodingError.Context( 30 codingPath: codingPath, 31 debugDescription: "Expected to decode type \(type) as primitive value." 32 ) 33 } 34 35 @inlinable 36 internal static func singleValueContainerCanOnlyActAsEmptyKeyedContainer(at codingPath: [any CodingKey]) -> Self { 37 DecodingError.Context( 38 codingPath: codingPath, 39 debugDescription: "Single value container can only act as an empty keyed container." 40 ) 41 } 42}