TIL: How to write Exception in Kotlin (opinionated...
# feed
m
TIL: How to write Exception in Kotlin (opinionated) 1. Kotlin recommends to use exception catch operator e.g:
Flow<T>.catch
,
runCatching {}
etc 2. Dual-use API introduced for convenient e.g:
getOrNull
,
getOrDefault
etc 3. Use preconditions and compile check when writing public API/method https://medium.com/sampingan-tech/kotlin-getting-to-knows-with-exceptions-564f8b2bc3c