In trying to run tests on my app in Swift, I am encountering a problem. I do not have any breakpoints set, and yet, the execution of the tests is being interrupted on the line containing "throw errorResult", with this:
Thread 23: EXC_BREAKPOINT (code=1, subcode=0x180d7bc70)
This error is handled as you can see in the second code snippet. How can I prevent this from interrupting testing? This is expected behaviour that I am trying to test. This does not happen if I delete this line and instead throw a generic error.
func doTheBiz<T: Decodable>(
query: GQLQuery,
serviceApiConfig: ServiceApiConfig
) async throws -> T {
capturedQueryString = query.body
if let successResult = successResult, let result = successResult as? T {
return result
} else if let errorResult = errorResult {
throw errorResult // stops here
} else {
throw NSError.generic()
}
}
This is the context for the call:
do {
...
bizInfo = try await bizService.doTheBiz(...)
...
self.state = .data
} catch {
if state == .data { return }
self.handleFailureResponse(error)
}
These tests ran absolutely fine in Xcode 16.2.