https://kotlinlang.org logo
#coroutines
Title
# coroutines
i

Icaro Temponi

07/30/2019, 7:26 PM
Hi everyone. So, I have the following function:
Copy code
private fun barcodeFlow(): Flow<Barcode> = callbackFlow {
        val onNext: (t: Barcode) -> Unit = { barcode -> offer(barcode) }
        val onError: (t: Throwable) -> Unit = { ex -> throw ex }
        val disposable = binding
                .barcodeView
                .drawOverlay()
                .getObservable()
                .subscribe(onNext, onError)
        awaitClose { disposable.dispose() }
}
I just would like to know if the exception thrown inside the onError lambda will be propagated down the stream of this callbackFlow to be caught on a subsequent catch operator as expected
d

Dominaezzz

07/30/2019, 7:39 PM
No I don't think so.
The exception will be passed back into whatever calls
onError
.
i

Icaro Temponi

07/30/2019, 7:42 PM
hm, makes sense 🤔
2 Views