Package com.google.api.client.googleapis.json

Examples of com.google.api.client.googleapis.json.GoogleJsonError$ErrorInfo


    }

    @Override
    public void onFailure(GoogleJsonErrorContainer e, HttpHeaders responseHeaders) {
      failureCalls++;
      GoogleJsonError error = e.getError();
      ErrorInfo errorInfo = error.getErrors().get(0);
      assertEquals(ERROR_DOMAIN, errorInfo.getDomain());
      assertEquals(ERROR_REASON, errorInfo.getReason());
      assertEquals(ERROR_MSG, errorInfo.getMessage());
      assertEquals(ERROR_CODE, error.getCode());
      assertEquals(ERROR_MSG, error.getMessage());
    }
View Full Code Here


      GoogleJsonErrorContainer errorContainer = new GoogleJsonErrorContainer();

      if (e.hasError()) {
        ErrorOutput.ErrorProto errorProto = e.getError();

        GoogleJsonError error = new GoogleJsonError();
        if (errorProto.hasCode()) {
          error.setCode(errorProto.getCode());
        }
        if (errorProto.hasMessage()) {
          error.setMessage(errorProto.getMessage());
        }

        List<ErrorInfo> errorInfos = new ArrayList<ErrorInfo>(errorProto.getErrorsCount());
        for (ErrorOutput.IndividualError individualError : errorProto.getErrorsList()) {
          ErrorInfo errorInfo = new ErrorInfo();
          if (individualError.hasDomain()) {
            errorInfo.setDomain(individualError.getDomain());
          }
          if (individualError.hasMessage()) {
            errorInfo.setMessage(individualError.getMessage());
          }
          if (individualError.hasReason()) {
            errorInfo.setReason(individualError.getReason());
          }
          errorInfos.add(errorInfo);
        }
        error.setErrors(errorInfos);
        errorContainer.setError(error);
      }
      callback.onFailure(errorContainer, responseHeaders);
    }
View Full Code Here

    try {
      request.executeUnparsed();
      fail("expected " + GoogleJsonResponseException.class);
    } catch (GoogleJsonResponseException e) {
      // expected
      GoogleJsonError details = e.getDetails();
      assertEquals("me", details.getMessage());
      assertEquals("me", details.getErrors().get(0).getMessage());
    }
  }
View Full Code Here

  DataStoreFactory dataStoreFactory;
  @VisibleForTesting int pollingDelay = 10000;

  public static String getErrorMessage(GoogleJsonResponseException e) {
    String message = e.getStatusMessage();
    GoogleJsonError details = e.getDetails();
    if (details != null) {
      message = details.getMessage() + " (" + details.getCode() + ")";
    }
    return message;
  }
View Full Code Here

TOP

Related Classes of com.google.api.client.googleapis.json.GoogleJsonError$ErrorInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.