commonMain.com.apollographql.apollo.api.internal.json.use.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of apollo-api-jvm Show documentation
Show all versions of apollo-api-jvm Show documentation
Apollo GraphQL API classes
package com.apollographql.apollo.api.internal.json
inline fun T.use(block: (T) -> R): R {
var exception: Throwable? = null
try {
return block(this)
} catch (e: Throwable) {
exception = e
throw e
} finally {
when {
this == null -> {}
exception == null -> close()
else ->
try {
close()
} catch (closeException: Throwable) {
}
}
}
}