Search in sources :

Example 1 with AppSyncExtensions

use of com.amplifyframework.datastore.appsync.AppSyncExtensions in project amplify-android by aws-amplify.

the class SubscriptionProcessor method isExceptionType.

private boolean isExceptionType(DataStoreException exception, AppSyncErrorType errorType) {
    if (exception instanceof GraphQLResponseException) {
        List<GraphQLResponse.Error> errors = ((GraphQLResponseException) exception).getErrors();
        GraphQLResponse.Error firstError = errors.get(0);
        if (Empty.check(firstError.getExtensions())) {
            return false;
        }
        AppSyncExtensions extensions = new AppSyncExtensions(firstError.getExtensions());
        return errorType.equals(extensions.getErrorType());
    }
    return false;
}
Also used : AppSyncExtensions(com.amplifyframework.datastore.appsync.AppSyncExtensions) GraphQLResponse(com.amplifyframework.api.graphql.GraphQLResponse) GraphQLResponseException(com.amplifyframework.datastore.DataStoreException.GraphQLResponseException)

Aggregations

GraphQLResponse (com.amplifyframework.api.graphql.GraphQLResponse)1 GraphQLResponseException (com.amplifyframework.datastore.DataStoreException.GraphQLResponseException)1 AppSyncExtensions (com.amplifyframework.datastore.appsync.AppSyncExtensions)1