Skip to content

Commit efbe079

Browse files
committed
support swift <6
1 parent fcfd214 commit efbe079

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Sources/IssueReporting/ErrorReporting.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,4 +280,29 @@ public func withErrorReporting<R>(
280280
}
281281
}
282282
}
283+
284+
@_transparent
285+
@_unsafeInheritExecutor
286+
public func withErrorReporting<R>(
287+
_ message: @autoclosure () -> String? = nil,
288+
to reporters: [any IssueReporter]? = nil,
289+
fileID: StaticString = #fileID,
290+
filePath: StaticString = #filePath,
291+
line: UInt = #line,
292+
column: UInt = #column,
293+
// DO NOT FIX THE WHITESPACE IN THE NEXT LINE UNTIL 5.10 IS UNSUPPORTED
294+
// https://github.com/swiftlang/swift/issues/79285
295+
catching body: () async throws -> sending R?) async -> R? {
296+
(
297+
await withErrorReporting(
298+
message(),
299+
to: reporters,
300+
fileID: fileID,
301+
filePath: filePath,
302+
line: line,
303+
column: column,
304+
catching: body
305+
) as R??
306+
) ?? nil
307+
}
283308
#endif

0 commit comments

Comments
 (0)