Alright, this is a compiling and seemingly working...
# arrow
k
Alright, this is a compiling and seemingly working version :
Copy code
fun <DTO> IO<DTO>.withToken(accessTokenRepository: IAccessTokenRepository): IO<DTO> = handleErrorWith {
    if (it is HttpException && it.code() == 401) {
        accessTokenRepository.refreshAccessToken().flatMap { withToken(accessTokenRepository) }
    } else {
        raiseError(it)
    }
}