https://kotlinlang.org logo
n

Nikky

06/22/2019, 8:50 PM
i guess i am jsut used to this pattern:
Copy code
val (request, response, result) = url.httpGet()
            .awaitObjectResponseResult(kotlinxDeserializerOf(loader = Type.serializer(), json = json))
        return when (result) {
            is Result.Success -> result.value
            is Result.Failure -> {
                logger.error("failed request")
                logger.error("url: $url")
                logger.error("cUrl: ${request.cUrlString()}")
                logger.error("response: $response")
                logger.error(result.error.exception) { result.error }
                throw result.error.exception
            }
        }
rethrowing might not be the wisest choice but thats not really what matters i guess i could make this same thing happen wit ha inline function and lamdda to configure the request or so.. to avoid copypasting the same stuff all over the place