Catching exceptions

Report a typo

What will the following code print?

try {
    flow { emit("") }
        .catch { println("Caught exception") }
        .map { throw Exception(); it }
        .map { println("Processed"); it.uppercase() }
        .onCompletion { exc -> exc?.let { println("Finished with error") } }
        .collect()
} catch (_: Exception) {
    println("Unhandled exception from flow")
}

Remember that all uncaught exceptions will be re-thrown after the completion
Select one option from the list
___

Create a free account to access the full topic