What happens if you combine 2 Flows and one of the...
# coroutines
f
What happens if you combine 2 Flows and one of them throws an exception? Will it be caught in a
catch
operator I add on the resulting (combined) Flow?
✔️ 1
l
Yes, you can also just try it on play.kotl.in or in a dummy/playground project
Copy code
val flow1 = flow<Whatever> { null! }
val flow2 = flow<Whatever> { emit(whatever()) }
val flowToTest = combine(flow1, flow2) { a, b -> stuff(flow1, flow2) }
TODO("test catch operator")
f
thank you
that play site is useful, I'll use that in the future
l
It's quite similar to a brand new project though
f
well I'm using Android Studio
l
You can have IntelliJ next to it, doesn't hurt 🙂
Also, once you created the project I'm pretty sure you can open it in Android Studio if needed.
f
makes sense, thank you
b
you can just write
Copy code
fun main() {
}
in any file in Android Studio at the top (below imports, if there are any), to test anything (Run button will appear in the left side bar to
fun main
)
l
It will take longer to compile than a blank project though
b
yes, but you will have an access to the project codebase. Plus, if a project modularized enough compile will be quite fast (faster than opening idea 🙂) in leaf module
l
Well, I have IDEA open already 😄
f
@bezrukov that's very cool, thank you