Tabnine Logo
GoogleJsonError.getErrors
Code IndexAdd Tabnine 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)

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
  • onRequestPermissionsResult (Fragment)
  • setScale (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • Permission (java.security)
    Legacy security code; do not use.
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Top plugins for WebStorm
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