Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Helper function for GQL
import com.apollographql.apollo.api.Response
internal suspend inline fun <S> runApolloRequest(block: () -> Response<S>): Result<S> = try {
val value = handleApolloRequest{(block()}
} catch (e: Exception) {
if (e is CancellationException) throw e
Timber.e("Exception from coroutine (${coroutineContext[CoroutineName]?.name}): " +
// call-site
val priceResult = runApolloRequest { apolloAPI.getPrice(id) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment