Hello, I'm currently developing/using a library wh...
# ktor
a
Hello, I'm currently developing/using a library which uses ktor http client to expose common function for calling other services. The thing is I'm calling this library from java code and I know ktor calls (eg
<http://httpClient.post|httpClient.post>(...)
) may throw some exceptions that are checked in java. Instead of annotating all my functions with
@Throws
wanted to understand if it would make sense to use a response exception handler and wrap all checked exceptions into
RuntimeException
s. What are your opinions? Thanks in advance đŸ˜„
s
We have also moved our network calls out to a separate lib, and all calls return an
Either<ApiError, T>
. (
Either
comes from #arrow.) That works great for us. And both Ktor and Arrow are multiplatform, so there are options for other platforms to hook into it, too, although I doubt it'll happen anytime soon in our case. đŸ˜…
mandalorian 1
a
Ya thats a great ideia I also prefer functional approach of returning instead of exception mechanism! But we were looking to keep it "transparent" for java side