is there any kind of arrow-kt integration for Ktor (specifically Ktor-client stuff)? Currently im using extension functions on HttpClient like
getSafe
that just wrap the
HttpClient.get
method in a `Try`object, but i wonder if there is any way to get that out of the box / with a library
d
Dominaezzz
08/23/2019, 8:07 PM
Because of type erasure, something like this isn't even possible yet. There's barely have support for
List<...>
but since
typeOf
is now a thing, it might be possible in a couple weeks.
Dominaezzz
08/23/2019, 8:08 PM
Also, IMO
Try
doesn't work well with
kotlinx.coroutines
particularly around cancellation, so I would advise against using it here.
l
Leon K
08/24/2019, 11:26 AM
what would you recommend using instead of Try? i really need some kind of type-safe way to handle failures, as my whole Project revolves around some Requests failing and others succeeding. I'd really hate to have to use try/catch everywhere...