Tabnine Logo
ApolloParseException.<init>
Code IndexAdd Tabnine to your IDE (free)

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

Best Java code snippets using com.apollographql.apollo.exception.ApolloParseException.<init> (Showing top 5 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: 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<init>

Popular methods of ApolloParseException

  • getCause
  • getMessage

Popular in Java

  • Running tasks concurrently on multiple threads
  • putExtra (Intent)
  • onCreateOptionsMenu (Activity)
  • setScale (BigDecimal)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Reference (javax.naming)
  • Top Sublime Text plugins
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