Skip to content

Commit

Permalink
Add support for typed throws
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed Nov 14, 2024
1 parent 97c1683 commit 3ca3d15
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/Socket/System/SocketHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extension SocketDescriptor {
/// If `body` throws an error
/// or an error occurs while closing the file descriptor,
/// this method rethrows that error.
public func closeAfter<R>(_ body: () throws -> R) throws -> R {
public func closeAfter<R>(_ body: () throws(Errno) -> R) throws(Errno) -> R {
// No underscore helper, since the closure's throw isn't necessarily typed.
let result: R
do {
Expand All @@ -42,7 +42,7 @@ extension SocketDescriptor {
/// If `body` throws an error
/// this method rethrows that error.
@_alwaysEmitIntoClient
public func closeIfThrows<R>(_ body: () throws -> R) throws -> R {
public func closeIfThrows<R>(_ body: () throws(Errno) -> R) throws(Errno) -> R {
do {
return try body()
} catch {
Expand Down

0 comments on commit 3ca3d15

Please sign in to comment.