Tabnine Logo
ApolloParseException
Code IndexAdd Tabnine to your IDE (free)

How to use
ApolloParseException
in
com.apollographql.apollo.exception

Best Java code snippets using com.apollographql.apollo.exception.ApolloParseException (Showing top 6 results out of 315)

origin: apollographql/apollo-android

@SuppressWarnings("unchecked") InterceptorResponse parse(Operation operation, okhttp3.Response httpResponse)
  throws ApolloHttpException, ApolloParseException {
 String cacheKey = httpResponse.request().header(HttpCache.CACHE_KEY_HEADER);
 if (httpResponse.isSuccessful()) {
  try {
   OperationResponseParser parser = new OperationResponseParser(operation, responseFieldMapper, scalarTypeAdapters,
     normalizer);
   Response parsedResponse = parser.parse(httpResponse.body().source())
     .toBuilder()
     .fromCache(httpResponse.cacheResponse() != null)
     .build();
   if (parsedResponse.hasErrors() && httpCache != null) {
    httpCache.removeQuietly(cacheKey);
   }
   return new InterceptorResponse(httpResponse, parsedResponse, normalizer.records());
  } catch (Exception rethrown) {
   logger.e(rethrown, "Failed to parse network response for operation: %s", operation);
   closeQuietly(httpResponse);
   if (httpCache != null) {
    httpCache.removeQuietly(cacheKey);
   }
   throw new ApolloParseException("Failed to parse http response", rethrown);
  }
 } else {
  logger.e("Failed to parse network response: %s", httpResponse);
  throw new ApolloHttpException(httpResponse);
 }
}
origin: apollographql/apollo-android

 @Override public boolean test(Throwable throwable) throws Exception {
  ApolloParseException e = (ApolloParseException) throwable;
  assertThat(e.getMessage()).isEqualTo("Failed to parse http response");
  assertThat(e.getCause().getClass()).isEqualTo(JsonEncodingException.class);
  return true;
 }
});
origin: awslabs/aws-mobile-appsync-sdk-android

@Override
public void onResponse(@Nonnull InterceptorResponse response) {
  callBack.onResponse(response);
  if ( callbackForPersistentMutation != null) {
    JSONObject jsonObject;
    try {
      jsonObject = new JSONObject(response.clonedBufferString.get());
      callbackForPersistentMutation.onResponse(new PersistentMutationsResponse(
          jsonObject.getJSONObject("data"),
          jsonObject.getJSONArray("errors"),
          request.operation.getClass().getSimpleName(),
          object.recordIdentifier));
    } catch (Exception e) {
      callbackForPersistentMutation.onFailure(new PersistentMutationsError(
          request.operation.getClass().getSimpleName(),
          object.recordIdentifier,
          new ApolloParseException(e.getLocalizedMessage()))
      );
    }
  }
  appSyncOfflineMutationManager.setInProgressPersistentMutationAsCompleted(object.recordIdentifier);
  queueHandler.clearInMemoryOfflineMutationObjectBeingExecuted();
  queueHandler.clearPersistentOfflineMutationObjectBeingExecuted();
  queueHandler.sendEmptyMessage(MessageNumberUtil.SUCCESSFUL_EXEC);
}
origin: awslabs/aws-mobile-appsync-sdk-android

public void onMessage(final String msg) {
  try {
    //TODO: Check why is this being converted to a Response Body
    ResponseBody messageBody = ResponseBody.create(MediaType.parse("text/plain"), msg);
    OperationResponseParser<D, T> parser = new OperationResponseParser(subscription,
        subscription.responseFieldMapper(), scalarTypeAdapters, normalizer);
    Response<T> parsedResponse = parser.parse(messageBody.source());
    if (parsedResponse.hasErrors()) {
      Log.w(TAG, "Errors detected in parsed subscription message");
    }
    //TODO: Check why the message is this is not done in an else clause
    propagateMessageToAllListeners(parsedResponse);
  } catch (Exception rethrown) {
    Log.e(TAG, "Failed to parse: " + msg, rethrown);
    notifyErrorToAllListeners(new ApolloParseException("Failed to parse http response", rethrown));
  }
}
origin: com.amazonaws/aws-android-sdk-appsync-runtime

 httpCache.removeQuietly(cacheKey);
throw new ApolloParseException("Failed to parse http response", rethrown);
origin: awslabs/aws-mobile-appsync-sdk-android

 httpCache.removeQuietly(cacheKey);
throw new ApolloParseException("Failed to parse http response", rethrown);
com.apollographql.apollo.exceptionApolloParseException

Most used methods

  • <init>
  • getCause
  • getMessage

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onCreateOptionsMenu (Activity)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • JList (javax.swing)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now