Skip to content

Commit e261ac8

Browse files
Use do throws(E) for concrete catch typing in JSRemote
Co-authored-by: Shelley <shelley@exe.dev>
1 parent 9512373 commit e261ac8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Sources/JavaScriptEventLoop/JSRemote.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,10 @@ private final class _JSRemoteContext: @unchecked Sendable {
6666
continuation: CheckedContinuation<Result<R, E>, Never>
6767
) {
6868
self.invokeBody = {
69-
do {
69+
do throws(E) {
7070
continuation.resume(returning: .success(try body(sourceObject)))
71-
} catch let error as E {
72-
continuation.resume(returning: .failure(error))
7371
} catch {
74-
preconditionFailure("Unexpected error type: \(error)")
72+
continuation.resume(returning: .failure(error))
7573
}
7674
return false
7775
}

0 commit comments

Comments
 (0)