Skip to content

Commit 5d831ef

Browse files
Added support for number and float decoding strategies
1 parent fafc16a commit 5d831ef

File tree

2 files changed

+136
-112
lines changed

2 files changed

+136
-112
lines changed

Sources/DynamicCodable/CoderInternals.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ extension DynamicCodable {
7070
}
7171

7272
@inline(__always)
73-
func unwrap<T>(errorHandler: () throws -> Never) rethrows -> T {
73+
func unwrap<T>(errorHandler: () throws -> T) rethrows -> T {
7474
switch T.self {
7575
case is Keyed.Type: if case .keyed(let keyed) = self { return unsafeBitCast(keyed, to: T.self) }
7676
case is Unkeyed.Type: if case .unkeyed(let unkeyed) = self { return unsafeBitCast(unkeyed, to: T.self) }
@@ -93,6 +93,6 @@ extension DynamicCodable {
9393
default: break // TODO: We should do something different here, so we can ignore this case in the caller. Perhaps return a specialized error?
9494
}
9595

96-
try errorHandler()
96+
return try errorHandler()
9797
}
9898
}

0 commit comments

Comments
 (0)