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

Examples of com.google.api.client.googleapis.json.GoogleJsonErrorContainer


      this.callback = callback;
    }

    @Override
    public void onFailure(ErrorOutput.ErrorBody e, HttpHeaders responseHeaders) throws IOException {
      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

TOP

Related Classes of com.google.api.client.googleapis.json.GoogleJsonErrorContainer

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.