-
- All Implemented Interfaces:
-
okhttp3.Interceptor
public class EmbraceOkHttp3ApplicationInterceptor implements InterceptorThis interceptor will only intercept errors that client app experiences.
We used OkHttp3 application interceptor in this case because this interceptor will be added first in the OkHttp3 interceptors stack. This allows us to catch network errors. OkHttp3 network interceptors are added almost at the end of stack, they are closer to "Wire" so they are not able to see network errors.
Application interceptors: - Don't need to worry about intermediate responses like redirects and retries. - Are always invoked once, even if the HTTP response is served from the cache. - Observe the application's original intent. Unconcerned with OkHttp-injected headers like If-None-Match. - Permitted to short-circuit and not call Chain.proceed(). - Permitted to retry and make multiple calls to Chain.proceed().
We used the EmbraceGraphQLException to capture the custom path added in the intercept chain process for client errors on graphql requests.
-
-
Constructor Summary
Constructors Constructor Description EmbraceOkHttp3ApplicationInterceptor()
-