Skip to content

Commit 4fa4af8

Browse files
committed
Adjust docs to list new async overload of catch function
1 parent 9987568 commit 4fa4af8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Sources/ErrorKit/Catching.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ extension Catching {
135135
) throws(Self) -> ReturnType {
136136
do {
137137
return try operation()
138-
} catch let error as Self {
138+
} catch let error as Self { // Avoid nesting if the error is already of the expected type
139139
throw error
140140
} catch {
141141
throw Self.caught(error)
@@ -182,7 +182,7 @@ extension Catching {
182182
) async throws(Self) -> ReturnType {
183183
do {
184184
return try await operation()
185-
} catch let error as Self {
185+
} catch let error as Self { // Avoid nesting if the error is already of the expected type
186186
throw error
187187
} catch {
188188
throw Self.caught(error)

Sources/ErrorKit/ErrorKit.docc/Guides/Typed-Throws-and-Error-Nesting.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ Be sure to explore the error chain debugging features to get the full benefit of
262262
### Essentials
263263

264264
- ``Catching``
265+
- ``Catching/catch(_:)-8kmn1``
265266
- ``Catching/catch(_:)``
266267

267268
### System Overloads

0 commit comments

Comments
 (0)