From 31d768346741c00e49a9b2b25306d0d993763493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20Bystr=C3=B6m=20Ericsson?= Date: Tue, 3 Dec 2024 08:40:10 +0100 Subject: [PATCH] Adopt typed throws in Fallible methods (#125). --- Sources/CoreKit/Models/Fallible+Map.swift | 4 ++-- Sources/CoreKit/Models/Fallible+Validation.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/CoreKit/Models/Fallible+Map.swift b/Sources/CoreKit/Models/Fallible+Map.swift index 272eb5fe..9cbde344 100644 --- a/Sources/CoreKit/Models/Fallible+Map.swift +++ b/Sources/CoreKit/Models/Fallible+Map.swift @@ -17,11 +17,11 @@ extension Fallible { // MARK: Transformations //=------------------------------------------------------------------------= - @inlinable public consuming func map(_ map: (Value) throws -> T) rethrows -> Fallible { + @inlinable public consuming func map(_ map: (Value) throws(E) -> T) throws(E) -> Fallible { Fallible(try map(self.value), error: self.error) } - @inlinable public consuming func map(_ map: (Value) throws -> Fallible) rethrows -> Fallible { + @inlinable public consuming func map(_ map: (Value) throws(E) -> Fallible) throws(E) -> Fallible { try map(self.value).veto(self.error) } } diff --git a/Sources/CoreKit/Models/Fallible+Validation.swift b/Sources/CoreKit/Models/Fallible+Validation.swift index 78e58c02..cc29bf51 100644 --- a/Sources/CoreKit/Models/Fallible+Validation.swift +++ b/Sources/CoreKit/Models/Fallible+Validation.swift @@ -32,7 +32,7 @@ extension Fallible { } /// Tries to return its `value` but throws `failure()` on `error`. - @inlinable public consuming func prune(_ failure: @autoclosure () -> Error) throws -> Value where Error: Swift.Error { + @inlinable public consuming func prune(_ failure: @autoclosure () -> Error) throws(Error) -> Value { if self.error { throw failure() } else {