How do you handle exceptions in cold streams produ...
# feed
e
How do you handle exceptions in cold streams produced by Kotlin Flows? Be puzzled no more: https://medium.com/@elizarov/exceptions-in-kotlin-flows-b59643c940fb
⏸️ 15
z
@elizarov Really interesting read, your blog is quickly becoming the de facto coroutine documentation. FYI, there is a small typo in there:
collect { value -> pdateUI(value) }
1
e
Thanks. I really hope it is not replacing documentation. We are trying to be quite thorough in the docs.
d
I'm wondering if it would be better to have
catch<IOException> { ... }
if someone needs to catch a specific exception instead of having to catch and rethrow the rest?
e
Unfortunately, we’ll have to give it another name, or “catch everything” will have to be written
catch<Throwable>
. We might improve this part of the language in the future, though.
👍🏼 3
a
Maybe could be implemented "Generic parameter defaults" as in typescript: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-3.html#generic-parameter-defaults
Copy code
class A<T = Throwable> { ... }
e