/** * Gets called when an http request error takes place due to network failures, timeouts etc. */ public void onNetworkError(@Nonnull ApolloNetworkException e) { onFailure(e); }
/** * Gets called when {@link GraphQLCall} has been canceled. */ public void onCanceledError(@Nonnull ApolloCanceledException e) { onFailure(e); } }
/** * Gets called when {@link GraphQLCall} has been canceled. */ public void onCanceledError(@Nonnull ApolloCanceledException e) { onFailure(e); } }
@Override public void enqueue(@Nullable final Callback responseCallback) { try { activate(Optional.fromNullable(responseCallback)); } catch (ApolloCanceledException e) { if (responseCallback != null) { responseCallback.onFailure(e); } else { logger.e(e, "Operation: %s was canceled", operation().name().name()); } return; } ApolloInterceptor.InterceptorRequest request = ApolloInterceptor.InterceptorRequest.builder(operation).build(); interceptorChain.proceedAsync(request, dispatcher, interceptorCallbackProxy()); }
@Override public void onFailure(@Nonnull ApolloException e) { Optional<Callback> callback = terminate(); if (!callback.isPresent()) { logger.e(e, "onFailure for prefetch operation: %s. No callback present.", operation().name().name()); return; } if (e instanceof ApolloHttpException) { callback.get().onHttpError((ApolloHttpException) e); } else if (e instanceof ApolloNetworkException) { callback.get().onNetworkError((ApolloNetworkException) e); } else { callback.get().onFailure(e); } }
@Override public void enqueue(@Nullable final Callback responseCallback) { try { activate(Optional.fromNullable(responseCallback)); } catch (ApolloCanceledException e) { if (responseCallback != null) { responseCallback.onFailure(e); } else { logger.e(e, "Operation: %s was canceled", operation().name().name()); } return; } ApolloInterceptor.InterceptorRequest request = ApolloInterceptor.InterceptorRequest.builder(operation).build(); interceptorChain.proceedAsync(request, dispatcher, interceptorCallbackProxy()); }
@Override public void onFailure(@Nonnull ApolloException e) { Optional<Callback> callback = terminate(); if (!callback.isPresent()) { logger.e(e, "onFailure for prefetch operation: %s. No callback present.", operation().name().name()); return; } if (e instanceof ApolloHttpException) { callback.get().onHttpError((ApolloHttpException) e); } else if (e instanceof ApolloNetworkException) { callback.get().onNetworkError((ApolloNetworkException) e); } else { callback.get().onFailure(e); } }
/** * Gets called when an http request error takes place due to network failures, timeouts etc. */ public void onNetworkError(@Nonnull ApolloNetworkException e) { onFailure(e); }
/** * Gets called when an http request error takes place. This is the case when the returned http status code doesn't * lie in the range 200 (inclusive) and 300 (exclusive). */ public void onHttpError(@Nonnull ApolloHttpException e) { onFailure(e); Response response = e.rawResponse(); if (response != null) { response.close(); } }
/** * Gets called when an http request error takes place. This is the case when the returned http status code doesn't * lie in the range 200 (inclusive) and 300 (exclusive). */ public void onHttpError(@Nonnull ApolloHttpException e) { onFailure(e); Response response = e.rawResponse(); if (response != null) { response.close(); } }
@Override public void run() { delegate.onFailure(e); } });