congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Error
Code IndexAdd Tabnine to your IDE (free)

How to use
Error
in
com.apollographql.apollo.api

Best Java code snippets using com.apollographql.apollo.api.Error (Showing top 11 results out of 315)

origin: apollographql/apollo-android

@SuppressWarnings("unchecked")
private Error readError(Map<String, Object> payload) {
 String message = null;
 final List<Error.Location> locations = new ArrayList<>();
 final Map<String, Object> customAttributes = new HashMap<>();
 for (Map.Entry<String, Object> entry : payload.entrySet()) {
  if ("message".equals(entry.getKey())) {
   Object value = entry.getValue();
   message = value != null ? value.toString() : null;
  } else if ("locations".equals(entry.getKey())) {
   List<Map<String, Object>> locationItems = (List<Map<String, Object>>) entry.getValue();
   if (locationItems != null) {
    for (Map<String, Object> item : locationItems) {
     locations.add(readErrorLocation(item));
    }
   }
  } else {
   if (entry.getValue() != null) {
    customAttributes.put(entry.getKey(), entry.getValue());
   }
  }
 }
 return new Error(message, locations, customAttributes);
}
origin: apollographql/apollo-android

 boolean isPersistedQueryNotSupported(List<Error> errors) {
  for (Error error : errors) {
   if (PROTOCOL_NEGOTIATION_ERROR_NOT_SUPPORTED.equalsIgnoreCase(error.message())) {
    return true;
   }
  }
  return false;
 }
}
origin: awslabs/aws-mobile-appsync-sdk-android

static boolean conflictPresent(Optional<Response> parsedResponse) {
  //Check if the parsed response contains a conflict.
  //The contract for conflicts is that the response will contain an error with the
  //string "The conditional request failed" and will contain a data element.
  if (parsedResponse == null || parsedResponse.get() == null || parsedResponse.get().hasErrors() == false) {
    return false;
  }
  Log.d(TAG, "Thread:[" + Thread.currentThread().getId() +"]: onResponse -- found error");
  if ( ! parsedResponse.get().errors().get(0).toString().contains("The conditional request failed") ) {
    return false;
  }
  Map customAttributes = ((Error) parsedResponse.get().errors().get(0)).customAttributes();
  if (customAttributes == null || customAttributes.get("data") == null ) {
    return false;
  }
  return true;
}
origin: awslabs/aws-mobile-appsync-sdk-android

@Override
public void onResponse(@Nonnull ApolloInterceptor.InterceptorResponse response) {
  Log.v(TAG, "Thread:[" + Thread.currentThread().getId() +"]: onResponse()");
  if(shouldRetry && ConflictResolutionHandler.conflictPresent(response.parsedResponse)) {
    //Set shouldRetry to false. Conflicts will only be attempted once.
    shouldRetry = false;
    //Found Conflict
    String conflictString = new JSONObject((Map)((Error) response.parsedResponse.get().errors().get(0)).customAttributes().get("data")).toString();
    //Send a message to the Queue handler to retry
    Message message = new Message();
    MutationInterceptorMessage msg = new MutationInterceptorMessage(originalMutation, currentMutation);
    msg.serverState = conflictString;
    msg.clientState = clientState;
    msg.requestIdentifier = recordIdentifier;
    msg.requestClassName = currentMutation.getClass().getSimpleName();
    message.obj = msg;
    message.what = MessageNumberUtil.RETRY_EXEC;
    queueHandler.sendMessage(message);
    return;
  }
  //Call the customer's callback
  customerCallBack.onResponse(response);
  //Set the mutation as completed.
  appSyncOfflineMutationManager.setInProgressMutationAsCompleted(recordIdentifier);
  //Send a message to the QueueHandler to process the next mutation in queue
  Message message = new Message();
  message.obj = new MutationInterceptorMessage();
  message.what = MessageNumberUtil.SUCCESSFUL_EXEC;
  queueHandler.sendMessage(message);
}
origin: apollographql/apollo-android

 @Override public Object answer(InvocationOnMock invocation) throws Throwable {
  ((ApolloInterceptor.CallBack) invocation.getArguments()[2]).onResponse(
    new ApolloInterceptor.InterceptorResponse(
      mockHttpResponse(),
      com.apollographql.apollo.api.Response.<MockOperation.Data>builder(new MockOperation())
        .errors(Collections.singletonList(new Error("SomeOtherError", null, null)))
        .build(),
      Collections.<Record>emptyList()
    )
  );
  return null;
 }
}).when(chain).proceedAsync(
origin: apollographql/apollo-android

boolean isPersistedQueryNotFound(List<Error> errors) {
 for (Error error : errors) {
  if (PROTOCOL_NEGOTIATION_ERROR_QUERY_NOT_FOUND.equalsIgnoreCase(error.message())) {
   return true;
  }
 }
 return false;
}
origin: apollographql/apollo-android

mockHttpResponse(),
com.apollographql.apollo.api.Response.<MockOperation.Data>builder(new MockOperation())
  .errors(Collections.singletonList(new Error("PersistedQueryNotFound", null, null)))
  .build(),
Collections.<Record>emptyList()
origin: awslabs/aws-mobile-appsync-sdk-android

@Test
public void testUpdateWithInvalidID() {
  AWSAppSyncClient awsAppSyncClient = AppSyncTestSetupHelper.createAppSyncClientWithIAM();
  assertNotNull(awsAppSyncClient);
  //Try to update a Post with a Fake ID
  final String updatedContent = "New content coming up @" + System.currentTimeMillis();
  final String randomID = UUID.randomUUID().toString();
  updatePost(awsAppSyncClient, randomID, updatedContent);
  assertNotNull(updatePostMutationResponse);
  assertNull(updatePostMutationResponse.data().updatePost());
  assertNotNull(updatePostMutationResponse.errors());
  Error error = updatePostMutationResponse.errors().get(0);
  assertNotNull(error);
  assertNotNull(error.message());
  assertTrue(error.message().contains("Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ConditionalCheckFailedException;"));
}
origin: apollographql/apollo-android

mockHttpResponse(),
com.apollographql.apollo.api.Response.<MockOperation.Data>builder(new MockOperation())
  .errors(Collections.singletonList(new Error("PersistedQueryNotSupported", null, null)))
  .build(),
Collections.<Record>emptyList()
origin: com.amazonaws/aws-android-sdk-appsync-runtime

@SuppressWarnings("unchecked")
private Error readError(Map<String, Object> payload) {
 String message = null;
 final List<Error.Location> locations = new ArrayList<>();
 final Map<String, Object> customAttributes = new HashMap<>();
 for (Map.Entry<String, Object> entry : payload.entrySet()) {
  if ("message".equals(entry.getKey())) {
   Object value = entry.getValue();
   message = value != null ? value.toString() : null;
  } else if ("locations".equals(entry.getKey())) {
   List<Map<String, Object>> locationItems = (List<Map<String, Object>>) entry.getValue();
   if (locationItems != null) {
    for (Map<String, Object> item : locationItems) {
     locations.add(readErrorLocation(item));
    }
   }
  } else {
   if (entry.getValue() != null) {
    customAttributes.put(entry.getKey(), entry.getValue());
   }
  }
 }
 return new Error(message, locations, customAttributes);
}
origin: awslabs/aws-mobile-appsync-sdk-android

@SuppressWarnings("unchecked")
private Error readError(Map<String, Object> payload) {
 String message = null;
 final List<Error.Location> locations = new ArrayList<>();
 final Map<String, Object> customAttributes = new HashMap<>();
 for (Map.Entry<String, Object> entry : payload.entrySet()) {
  if ("message".equals(entry.getKey())) {
   Object value = entry.getValue();
   message = value != null ? value.toString() : null;
  } else if ("locations".equals(entry.getKey())) {
   List<Map<String, Object>> locationItems = (List<Map<String, Object>>) entry.getValue();
   if (locationItems != null) {
    for (Map<String, Object> item : locationItems) {
     locations.add(readErrorLocation(item));
    }
   }
  } else {
   if (entry.getValue() != null) {
    customAttributes.put(entry.getKey(), entry.getValue());
   }
  }
 }
 return new Error(message, locations, customAttributes);
}
com.apollographql.apollo.apiError

Javadoc

Represents an error response returned from the GraphQL server

Most used methods

  • <init>
  • message
    Returns server error message.
  • customAttributes
    Returns custom attributes associated with this error

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • requestLocationUpdates (LocationManager)
  • getSharedPreferences (Context)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Permission (java.security)
    Legacy security code; do not use.
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JOptionPane (javax.swing)
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top 12 Jupyter Notebook extensions
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