From 3ca3d15673f99e787f4d3a79a8b7607addb9403c Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Thu, 14 Nov 2024 04:02:29 -0500 Subject: [PATCH] Add support for typed throws --- Sources/Socket/System/SocketHelpers.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Socket/System/SocketHelpers.swift b/Sources/Socket/System/SocketHelpers.swift index f0e9ab2..50bba34 100644 --- a/Sources/Socket/System/SocketHelpers.swift +++ b/Sources/Socket/System/SocketHelpers.swift @@ -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(_ body: () throws -> R) throws -> R { + public func closeAfter(_ body: () throws(Errno) -> R) throws(Errno) -> R { // No underscore helper, since the closure's throw isn't necessarily typed. let result: R do { @@ -42,7 +42,7 @@ extension SocketDescriptor { /// If `body` throws an error /// this method rethrows that error. @_alwaysEmitIntoClient - public func closeIfThrows(_ body: () throws -> R) throws -> R { + public func closeIfThrows(_ body: () throws(Errno) -> R) throws(Errno) -> R { do { return try body() } catch {