@@ -65,31 +65,17 @@ extension Runner {
65
65
///
66
66
/// This function encapsulates the standard error handling performed by
67
67
/// ``Runner`` when running a test or test case.
68
- private func _withErrorHandling( sourceLocation: SourceLocation , _ body: ( ) async throws -> Void ) async throws -> Void {
68
+ private func _withErrorHandling( sourceLocation: SourceLocation , _ body: ( ) async throws -> Void ) async {
69
69
// Ensure that we are capturing backtraces for errors before we start
70
70
// expecting to see them.
71
71
Backtrace . startCachingForThrownErrors ( )
72
72
defer {
73
73
Backtrace . flushThrownErrorCache ( )
74
74
}
75
75
76
- // A local error type that represents an error that was already handled in
77
- // a previous scope.
78
- //
79
- // Instances of this type are thrown from this function after any other
80
- // error is caught. Subsequent outer calls to this function will then
81
- // avoid producing events for the same error. We bother doing this at all
82
- // because we may need to cancel the parent task after a child task is
83
- // cancelled, and the simplest way to do so is to just keep rethrowing.
84
- struct AlreadyHandled : Error { }
85
-
86
76
do {
87
77
try await body ( )
88
78
89
- } catch is AlreadyHandled {
90
- // This error stands in for an earlier error that should not be reported
91
- // again. It is not converted to an event.
92
-
93
79
} catch is ExpectationFailedError {
94
80
// This error is thrown by `__check()` to indicate that its condition
95
81
// evaluated to `false`. That function emits its own issue, so we don't
@@ -252,8 +238,8 @@ extension Runner {
252
238
}
253
239
254
240
if let step = stepGraph. value, case . run = step. action {
255
- try await Test . withCurrent ( step. test) {
256
- try await _withErrorHandling ( sourceLocation: step. test. sourceLocation) {
241
+ await Test . withCurrent ( step. test) {
242
+ await _withErrorHandling ( sourceLocation: step. test. sourceLocation) {
257
243
try await _executeTraits ( for: step, testCase: nil ) {
258
244
// Run the test function at this step (if one is present.)
259
245
if let testCases = step. test. testCases {
@@ -320,9 +306,9 @@ extension Runner {
320
306
Event . post ( . testCaseEnded, for: step. test, testCase: testCase, configuration: configuration)
321
307
}
322
308
323
- try await Test . Case. withCurrent ( testCase) {
309
+ await Test . Case. withCurrent ( testCase) {
324
310
let sourceLocation = step. test. sourceLocation
325
- try await _withErrorHandling ( sourceLocation: sourceLocation) {
311
+ await _withErrorHandling ( sourceLocation: sourceLocation) {
326
312
try await withTimeLimit ( for: step. test, configuration: configuration) {
327
313
try await _executeTraits ( for: step, testCase: testCase) {
328
314
try await testCase. body ( )
0 commit comments