Is there a way to add a Coroutine ExceptionHandler...
# coroutines
e
Is there a way to add a Coroutine ExceptionHandler when using onEach + launchIn? Context: I love using
flow.onEach{}.launchIn(scope)
over
scope.launch{ flow.collect{} }
because it makes it look cleaner (personal preference). But what i do miss is the ability to pass in a exception handler like
scope.launch(exceptionHandler) { ...collect()  }
. is there a way we can somehow add an exceptionhandler to Flow.launchIn() function?
e
.launchIn(scope + exceptionhandler)
should behave the same way
😮 1
e
Wow TIL something new. Thanks @ephemient! This is exactly what i wanted
b
Why not just use
catch {}
on your flow?
e
we do use catch in a lot of places. But we have a lot of streams that are collected in a single component that we want each flows to be handled in a single source and it be nice to utilize the exception handler
👍 1