11/// Evaluates a throwing closure and automatically catches and reports any error thrown.
22///
33/// - Parameters:
4+ /// - message: A message describing the expectation.
45/// - reporters: Issue reporters to notify during the operation.
56/// - fileID: The source `#fileID` associated with the error reporting.
67/// - filePath: The source `#filePath` associated with the error reporting.
1011/// - Returns: The optional result of the operation, or `nil` if an error was thrown.
1112@_transparent
1213public func withErrorReporting< R> (
13- _ reporters: [ any IssueReporter ] ? = nil ,
14+ _ message: @autoclosure ( ) -> String ? = nil ,
15+ to reporters: [ any IssueReporter ] ? = nil ,
1416 fileID: StaticString = #fileID,
1517 filePath: StaticString = #filePath,
1618 line: UInt = #line,
@@ -22,15 +24,29 @@ public func withErrorReporting<R>(
2224 do {
2325 return try body ( )
2426 } catch {
25- reportIssue ( error, fileID: fileID, filePath: filePath, line: line, column: column)
27+ reportIssue (
28+ error,
29+ message ( ) ,
30+ fileID: fileID,
31+ filePath: filePath,
32+ line: line,
33+ column: column
34+ )
2635 return nil
2736 }
2837 }
2938 } else {
3039 do {
3140 return try body ( )
3241 } catch {
33- reportIssue ( error, fileID: fileID, filePath: filePath, line: line, column: column)
42+ reportIssue (
43+ error,
44+ message ( ) ,
45+ fileID: fileID,
46+ filePath: filePath,
47+ line: line,
48+ column: column
49+ )
3450 return nil
3551 }
3652 }
@@ -39,6 +55,7 @@ public func withErrorReporting<R>(
3955/// Evaluates a throwing closure and automatically catches and reports any error thrown.
4056///
4157/// - Parameters:
58+ /// - message: A message describing the expectation.
4259/// - reporters: Issue reporters to notify during the operation.
4360/// - fileID: The source `#fileID` associated with the error reporting.
4461/// - filePath: The source `#filePath` associated with the error reporting.
@@ -48,7 +65,8 @@ public func withErrorReporting<R>(
4865/// - Returns: The optional result of the operation, or `nil` if an error was thrown.
4966@_transparent
5067public func withErrorReporting< R> (
51- _ reporters: [ any IssueReporter ] ? = nil ,
68+ _ message: @autoclosure ( ) -> String ? = nil ,
69+ to reporters: [ any IssueReporter ] ? = nil ,
5270 fileID: StaticString = #fileID,
5371 filePath: StaticString = #filePath,
5472 line: UInt = #line,
0 commit comments