Codota Logo
GoogleJsonError.getErrors
Code IndexAdd Codota to your IDE (free)

How to use
getErrors
method
in
com.google.api.client.googleapis.json.GoogleJsonError

Best Java code snippets using com.google.api.client.googleapis.json.GoogleJsonError.getErrors (Showing top 19 results out of 315)

  • Common ways to obtain GoogleJsonError
private void myMethod () {
GoogleJsonError g =
  • Codota Iconnew GoogleJsonError()
  • Codota IconGoogleJsonResponseException googleJsonResponseException;googleJsonResponseException.getDetails()
  • Smart code suggestions by Codota
}
origin: googleapis/google-cloud-java

private static String reason(GoogleJsonError error) {
 if (error.getErrors() != null && !error.getErrors().isEmpty()) {
  return error.getErrors().get(0).getReason();
 }
 return null;
}
origin: googleapis/google-cloud-java

private static ExceptionData makeExceptionData(
  GoogleJsonError googleJsonError,
  boolean idempotent,
  Set<BaseServiceException.Error> retryableErrors) {
 int code = googleJsonError.getCode();
 String reason = reason(googleJsonError);
 ExceptionData.Builder exceptionData = ExceptionData.newBuilder();
 exceptionData
   .setMessage(googleJsonError.getMessage())
   .setCause(null)
   .setRetryable(BaseServiceException.isRetryable(code, reason, idempotent, retryableErrors))
   .setCode(code)
   .setReason(reason);
 if (reason != null) {
  GoogleJsonError.ErrorInfo errorInfo = googleJsonError.getErrors().get(0);
  exceptionData.setLocation(errorInfo.getLocation());
  exceptionData.setDebugInfo((String) errorInfo.get("debugInfo"));
 } else {
  exceptionData.setLocation(null);
  exceptionData.setDebugInfo(null);
 }
 return exceptionData.build();
}
origin: googleapis/google-cloud-java

retryable = error.isRetryable(idempotent, retryableErrors);
if (reason != null) {
 GoogleJsonError.ErrorInfo errorInfo = jsonError.getErrors().get(0);
 location = errorInfo.getLocation();
 debugInfo = (String) errorInfo.get("debugInfo");
origin: google/google-api-java-client-samples

List<ErrorInfo> errors = e.getDetails().getErrors();
for (ErrorInfo error : errors) {
 if (error.getReason().equals("noAdSenseAccount")) {
origin: com.google.cloud/gcloud-java-core

private static String reason(GoogleJsonError error) {
 if (error.getErrors() != null && !error.getErrors().isEmpty()) {
  return error.getErrors().get(0).getReason();
 }
 return null;
}
origin: com.google.cloud.bigdataoss/util

/**
 * Get the first ErrorInfo from a GoogleJsonError, or null if
 * there is not one.
 */
protected ErrorInfo getErrorInfo(GoogleJsonError details) {
 if (details == null) {
  return null;
 }
 List<ErrorInfo> errors = details.getErrors();
 return errors.isEmpty() ? null : errors.get(0);
}
origin: com.google.cloud/google-cloud-core-http

private static String reason(GoogleJsonError error) {
 if (error.getErrors() != null && !error.getErrors().isEmpty()) {
  return error.getErrors().get(0).getReason();
 }
 return null;
}
origin: GoogleCloudPlatform/bigdata-interop

/**
 * Get the first ErrorInfo from a GoogleJsonError, or null if
 * there is not one.
 */
protected ErrorInfo getErrorInfo(GoogleJsonError details) {
 if (details == null) {
  return null;
 }
 List<ErrorInfo> errors = details.getErrors();
 return errors.isEmpty() ? null : errors.get(0);
}
origin: GoogleCloudPlatform/cloud-sql-jdbc-socket-factory

 response = adminApi.sslCerts().createEphemeral(projectId, instanceName, req).execute();
} catch (GoogleJsonResponseException e) {
 if (e.getDetails() == null || e.getDetails().getErrors().isEmpty()) {
  throw
    new RuntimeException(
 String reason = e.getDetails().getErrors().get(0).getReason();
 if (INSTANCE_NOT_AUTHORIZED_REASON.equals(reason)) {
  String who = "you have";
origin: com.google.cloud.sql/jdbc-socket-factory-core

 response = adminApi.sslCerts().createEphemeral(projectId, instanceName, req).execute();
} catch (GoogleJsonResponseException e) {
 if (e.getDetails() == null || e.getDetails().getErrors().isEmpty()) {
  throw
    new RuntimeException(
 String reason = e.getDetails().getErrors().get(0).getReason();
 if (INSTANCE_NOT_AUTHORIZED_REASON.equals(reason)) {
  String who = "you have";
origin: com.mulesoft.google/google-api-commons

public BatchResponse<T> addError(GoogleJsonError error) {
  this.errors.addAll(error.getErrors());
  this.resultBuilder.addItem(BulkItem.<T>builder()
      .setSuccessful(false)
      .setStatusCode(String.valueOf(error.getCode()))
      .setMessage(error.getMessage())
  );
  
  return this;
}
origin: com.google.cloud.sql/jdbc-socket-factory-core

 instance = adminApi.instances().get(projectId, instanceName).execute();
} catch (GoogleJsonResponseException e) {
 if (e.getDetails() == null || e.getDetails().getErrors().isEmpty()) {
  throw
    new RuntimeException(
 String reason = e.getDetails().getErrors().get(0).getReason();
 if (ADMIN_API_NOT_ENABLED_REASON.equals(reason)) {
  String apiLink =
origin: GoogleCloudPlatform/cloud-sql-jdbc-socket-factory

 instance = adminApi.instances().get(projectId, instanceName).execute();
} catch (GoogleJsonResponseException e) {
 if (e.getDetails() == null || e.getDetails().getErrors().isEmpty()) {
  throw
    new RuntimeException(
 String reason = e.getDetails().getErrors().get(0).getReason();
 if (ADMIN_API_NOT_ENABLED_REASON.equals(reason)) {
  String apiLink =
origin: com.google.cloud/gcloud-java-core

public BaseServiceException(GoogleJsonError googleJsonError, boolean idempotent) {
 super(googleJsonError.getMessage());
 Error error = new Error(googleJsonError.getCode(), reason(googleJsonError));
 this.code = error.code;
 this.reason = error.reason;
 this.retryable = isRetryable(idempotent, error);
 if (this.reason != null) {
  GoogleJsonError.ErrorInfo errorInfo = googleJsonError.getErrors().get(0);
  this.location = errorInfo.getLocation();
  this.debugInfo = (String) errorInfo.get("debugInfo");
 } else {
  this.location = null;
  this.debugInfo = null;
 }
 this.idempotent = idempotent;
}
origin: iterate-ch/cyberduck

  @Override
  public BackgroundException map(final IOException failure) {
    final StringBuilder buffer = new StringBuilder();
    if(failure instanceof GoogleJsonResponseException) {
      final GoogleJsonResponseException error = (GoogleJsonResponseException) failure;
      this.append(buffer, error.getDetails().getMessage());
      switch(error.getDetails().getCode()) {
        case HttpStatus.SC_FORBIDDEN:
          final List<GoogleJsonError.ErrorInfo> errors = error.getDetails().getErrors();
          for(GoogleJsonError.ErrorInfo info : errors) {
            if("usageLimits".equals(info.getDomain())) {
              return new RetriableAccessDeniedException(buffer.toString(), Duration.ofSeconds(5), failure);
            }
          }
          break;
      }
    }
    if(failure instanceof HttpResponseException) {
      final HttpResponseException response = (HttpResponseException) failure;
      this.append(buffer, response.getStatusMessage());
      return new HttpResponseExceptionMappingService().map(new org.apache.http.client
          .HttpResponseException(response.getStatusCode(), buffer.toString()));
    }
    return super.map(failure);
  }
}
origin: GoogleCloudPlatform/pubsub

 return;
if (!e1.getDetails().getErrors().get(0).getReason().equals("resourceNotReady")) {
 throw e1;
origin: com.google.cloud/gcloud-java-core

public BaseServiceException(IOException exception, boolean idempotent) {
 super(message(exception), exception);
 int code = UNKNOWN_CODE;
 String reason = null;
 String location = null;
 String debugInfo = null;
 Boolean retryable = null;
 if (exception instanceof GoogleJsonResponseException) {
  GoogleJsonError jsonError = ((GoogleJsonResponseException) exception).getDetails();
  if (jsonError != null) {
   Error error = new Error(jsonError.getCode(), reason(jsonError));
   code = error.code;
   reason = error.reason;
   retryable = isRetryable(idempotent, error);
   if (reason != null) {
    GoogleJsonError.ErrorInfo errorInfo = jsonError.getErrors().get(0);
    location = errorInfo.getLocation();
    debugInfo = (String) errorInfo.get("debugInfo");
   }
  } else {
   code = ((GoogleJsonResponseException) exception).getStatusCode();
  }
 }
 this.retryable = MoreObjects.firstNonNull(retryable, isRetryable(idempotent, exception));
 this.code = code;
 this.reason = reason;
 this.idempotent = idempotent;
 this.location = location;
 this.debugInfo = debugInfo;
}
origin: com.google.cloud/google-cloud-core-http

private static ExceptionData makeExceptionData(
  GoogleJsonError googleJsonError,
  boolean idempotent,
  Set<BaseServiceException.Error> retryableErrors) {
 int code = googleJsonError.getCode();
 String reason = reason(googleJsonError);
 ExceptionData.Builder exceptionData = ExceptionData.newBuilder();
 exceptionData
   .setMessage(googleJsonError.getMessage())
   .setCause(null)
   .setRetryable(BaseServiceException.isRetryable(code, reason, idempotent, retryableErrors))
   .setCode(code)
   .setReason(reason);
 if (reason != null) {
  GoogleJsonError.ErrorInfo errorInfo = googleJsonError.getErrors().get(0);
  exceptionData.setLocation(errorInfo.getLocation());
  exceptionData.setDebugInfo((String) errorInfo.get("debugInfo"));
 } else {
  exceptionData.setLocation(null);
  exceptionData.setDebugInfo(null);
 }
 return exceptionData.build();
}
origin: com.google.cloud/google-cloud-core-http

retryable = error.isRetryable(idempotent, retryableErrors);
if (reason != null) {
 GoogleJsonError.ErrorInfo errorInfo = jsonError.getErrors().get(0);
 location = errorInfo.getLocation();
 debugInfo = (String) errorInfo.get("debugInfo");
com.google.api.client.googleapis.jsonGoogleJsonErrorgetErrors

Javadoc

Returns the list of detailed errors or null for none.

Popular methods of GoogleJsonError

  • getMessage
    Returns the human-readable explanation of the error or null for none.
  • getCode
    Returns the HTTP status code of this response or null for none.
  • <init>
  • setCode
    Sets the HTTP status code of this response or null for none.
  • setMessage
    Sets the human-readable explanation of the error or null for none.
  • setErrors
    Sets the list of detailed errors or null for none.
  • toPrettyString
  • get
  • setFactory
  • toString

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • getSharedPreferences (Context)
  • URLConnection (java.net)
    The abstract class URLConnection is the superclass of all classes that represent a communications li
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • JComboBox (javax.swing)
  • JPanel (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now