small improvement in AccumulatorFlow

This commit is contained in:
InsanusMokrassar 2024-12-04 10:16:19 +06:00
parent b915f6ece2
commit 18c608f569
2 changed files with 5 additions and 2 deletions

View File

@ -2,6 +2,9 @@
## 0.23.2
* `Coroutines`:
* Small refactor in `AccumulatorFlow` to use `runCatching` instead of `runCatchingSafely`
## 0.23.1
* `Versions`:

View File

@ -68,9 +68,9 @@ class AccumulatorFlow<T>(
override suspend fun collectSafely(collector: FlowCollector<T>) {
val channel = Channel<T>(Channel.UNLIMITED, BufferOverflow.SUSPEND)
steps.send(SubscribeAccumulatorFlowStep(channel))
val result = runCatchingSafely {
val result = runCatching {
for (data in channel) {
val emitResult = runCatchingSafely {
val emitResult = runCatching {
collector.emit(data)
}
if (emitResult.isSuccess || emitResult.exceptionOrNull() is CancellationException) {