Problém:
Mám následující funkci, která zobrazuje varování No calls to throwing functions occur within 'try' expression
Otázky:
- Proč je toto varování se zobrazí? (Kód uvnitř úkolem hodí chybu)
- Co bych měl udělat, aby šíření chybu, aby volající
f1
?
Kód:
func f1() async throws {
try await withThrowingTaskGroup(of: Int.self) { group in //No calls to throwing functions occur within 'try' expression
group.addTask(priority: .high) {
throw NSError()
}
}
}
withThrowingTaskGroup
čekat na všechny úkoly dokončit, i kdyžgroup.waitForAll()
není vyvolána?