https://kotlinlang.org logo
#arrow
Title
k

kluck

05/09/2019, 8:17 AM
@Sergio Crespo Toubes That could come in handy, I am currently using CallK and "manually" converting to IO using unwrapBody. But even with the
Response
removed from my signature, I still get an
IO<Any?>
🤔
Copy code
fun <DTO> IO<DTO>.withToken(accessToken: IO<AccessToken>): IO<DTO> = handleErrorWith { t ->
        if (t is HttpException && t.code() == 401) {
            accessToken.flatMap { this@withToken.withToken(accessToken) }
        } else {
            raiseError<Response<DTO>>(IllegalArgumentException()).fix()
        }