@@ -184,12 +184,7 @@ extension DynamicCodableDecoder.Decoder: Swift.Decoder {
184
184
@inline ( __always)
185
185
func validate< T: BinaryFloatingPoint > ( _ floatingPoint: T , originalValue: CustomStringConvertible ) throws -> T {
186
186
guard floatingPoint. isFinite else {
187
- throw DecodingError . dataCorrupted (
188
- . init(
189
- codingPath: codingPath,
190
- debugDescription: " Represented number < \( floatingPoint) > does not fit in \( T . self) . "
191
- )
192
- )
187
+ throw dataCorruptedError ( " Represented number < \( floatingPoint) > does not fit in \( T . self) . " )
193
188
}
194
189
195
190
return floatingPoint
@@ -260,12 +255,7 @@ extension DynamicCodableDecoder.Decoder: Swift.Decoder {
260
255
@inline ( __always)
261
256
func validate< T: FixedWidthInteger > ( _ fixedWidthInteger: T ? , originalValue: CustomStringConvertible ) throws -> T {
262
257
guard let fixedWidthInteger = fixedWidthInteger else {
263
- throw DecodingError . dataCorrupted (
264
- . init(
265
- codingPath: codingPath,
266
- debugDescription: " Represented number < \( originalValue) > does not fit in \( T . self) . "
267
- )
268
- )
258
+ throw dataCorruptedError ( " Represented number < \( originalValue) > does not fit in \( T . self) . " )
269
259
}
270
260
271
261
return fixedWidthInteger
@@ -303,6 +293,15 @@ extension DynamicCodableDecoder.Decoder: Swift.Decoder {
303
293
)
304
294
)
305
295
}
296
+
297
+ private func dataCorruptedError( _ debugDescription: String ) -> DecodingError {
298
+ DecodingError . dataCorrupted (
299
+ . init(
300
+ codingPath: codingPath,
301
+ debugDescription: debugDescription
302
+ )
303
+ )
304
+ }
306
305
}
307
306
308
307
extension DynamicCodableDecoder . Decoder {
0 commit comments