RetryOnErrorInterceptor

fun RetryOnErrorInterceptor(networkMonitor: NetworkMonitor? = null, retryStrategy: RetryStrategy = defaultRetryStrategy): ApolloInterceptor

Returns a default ApolloInterceptor that monitors exceptions and possibly retries the Flow according to retryStrategy.

Use with com.apollographql.apollo.ApolloClient.Builder.retryOnErrorInterceptor:

apolloClient = ApolloClient.Builder()
.serverUrl("https://...")
.retryOnErrorInterceptor(RetryOnErrorInterceptor(NetworkMonitor(context)))
.build()

Because it is hard to determine whether an exception is recoverable and because different apps may have different timeout/retry requirements, customizing this interceptor using a RetryStrategy is encouraged.

See also