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

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

Best Java code snippets using com.google.api.client.googleapis.json.GoogleJsonError.getMessage (Showing top 20 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 message(IOException exception) {
  if (exception instanceof GoogleJsonResponseException) {
   GoogleJsonError details = ((GoogleJsonResponseException) exception).getDetails();
   if (details != null) {
    return details.getMessage();
   }
  }
  return exception.getMessage();
 }
}
origin: google/google-api-java-client-samples

 @Override
 public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) {
  System.out.println("Error Message: " + e.getMessage());
 }
});
origin: google/google-api-java-client-samples

 @Override
 public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) {
  System.out.println("Error Message: " + e.getMessage());
 }
};
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: pentaho/pentaho-kettle

if ( gjre.getDetails() != null && gjre.getDetails().getMessage() != null ) {
 exceptionToDisplay = new IOException( gjre.getDetails().getMessage(), gjre );
origin: google/google-api-java-client-samples

public static Bucket createInProject(Storage storage, String project, Bucket bucket)
  throws IOException {
 try {
  Storage.Buckets.Insert insertBucket = storage.buckets().insert(project, bucket);
  return insertBucket.execute();
 } catch (GoogleJsonResponseException e) {
  GoogleJsonError error = e.getDetails();
  if (error != null && error.getCode() == HTTP_CONFLICT
    && error.getMessage().contains("You already own this bucket.")) {
   System.out.println("already exists");
   return bucket;
  }
  System.err.println(error.getMessage());
  throw e;
 }
}

origin: google/google-api-java-client-samples

/**
 * Main demo. An Analytics service object is instantiated and then it is used to traverse and
 * print all the Management API entities. If any exceptions occur, they are caught and printed.
 *
 * @param args command line args.
 */
public static void main(String args[]) {
 try {
  HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
  DATA_STORE_FACTORY = new FileDataStoreFactory(DATA_STORE_DIR);
  Analytics analytics = initializeAnalytics();
  printManagementEntities(analytics);
 } catch (GoogleJsonResponseException e) {
  System.err.println("There was a service error: " + e.getDetails().getCode() + " : "
    + e.getDetails().getMessage());
 } catch (Throwable t) {
  t.printStackTrace();
 }
}
origin: google/google-api-java-client-samples

/**
 * Main demo. This first initializes an analytics service object. It then uses the Google
 * Analytics Management API to get the first profile ID for the authorized user. It then uses the
 * Core Reporting API to retrieve the top 25 organic search terms. Finally the results are printed
 * to the screen. If an API error occurs, it is printed here.
 *
 * @param args command line args.
 */
public static void main(String[] args) {
 try {
  httpTransport = GoogleNetHttpTransport.newTrustedTransport();
  dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);
  Analytics analytics = initializeAnalytics();
  String profileId = getFirstProfileId(analytics);
  if (profileId == null) {
   System.err.println("No profiles found.");
  } else {
   GaData gaData = executeDataQuery(analytics, profileId);
   printGaData(gaData);
  }
 } catch (GoogleJsonResponseException e) {
  System.err.println("There was a service error: " + e.getDetails().getCode() + " : "
    + e.getDetails().getMessage());
 } catch (Throwable t) {
  t.printStackTrace();
 }
}
origin: google/google-api-java-client-samples

/**
 * Main demo. This first initializes an analytics service object. It then uses the MCF API to
 * retrieve the top 25 source paths with most total conversions. It will also retrieve the top 25
 * organic sources with most total conversions. Finally the results are printed to the screen. If
 * an API error occurs, it is printed here.
 *
 * @param args command line args.
 */
public static void main(String[] args) {
 try {
  HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
  DATA_STORE_FACTORY = new FileDataStoreFactory(DATA_STORE_DIR);
  Analytics analytics = initializeAnalytics();
  McfData mcfPathData = executePathQuery(analytics, TABLE_ID);
  printAllInfo(mcfPathData);
  McfData mcfInteractionData = executeInteractionQuery(analytics, TABLE_ID);
  printAllInfo(mcfInteractionData);
 } catch (GoogleJsonResponseException e) {
  System.err.println("There was a service error: " + e.getDetails().getCode() + " : "
    + e.getDetails().getMessage());
 } catch (Throwable t) {
  t.printStackTrace();
 }
}
origin: google/google-api-java-client-samples

/**
 * Main demo. This first initializes an Analytics service object. It then queries for the top 25
 * organic search keywords and traffic sources by visits. Finally each important part of the
 * response is printed to the screen.
 *
 * @param args command line args.
 */
public static void main(String[] args) {
 try {
  HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
  DATA_STORE_FACTORY = new FileDataStoreFactory(DATA_STORE_DIR);
  Analytics analytics = initializeAnalytics();
  GaData gaData = executeDataQuery(analytics, TABLE_ID);
  printReportInfo(gaData);
  printProfileInfo(gaData);
  printQueryInfo(gaData);
  printPaginationInfo(gaData);
  printTotalsForAllResults(gaData);
  printColumnHeaders(gaData);
  printDataTable(gaData);
 } catch (GoogleJsonResponseException e) {
  System.err.println("There was a service error: " + e.getDetails().getCode() + " : "
    + e.getDetails().getMessage());
 } catch (Throwable t) {
  t.printStackTrace();
 }
}
origin: google/google-api-java-client-samples

System.err.println(error.getMessage());
origin: googleglass/mirror-quickstart-java

 @Override
 public void onFailure(GoogleJsonError error, HttpHeaders headers) throws IOException {
  ++failure;
  LOG.info("Failed to insert item: " + error.getMessage());
 }
}
origin: com.google.cloud/google-cloud-core-http

 private static String message(IOException exception) {
  if (exception instanceof GoogleJsonResponseException) {
   GoogleJsonError details = ((GoogleJsonResponseException) exception).getDetails();
   if (details != null) {
    return details.getMessage();
   }
  }
  return exception.getMessage();
 }
}
origin: com.google.cloud/gcloud-java-core

private static String message(IOException exception) {
 if (exception instanceof GoogleJsonResponseException) {
  GoogleJsonError details = ((GoogleJsonResponseException) exception).getDetails();
  if (details != null) {
   return details.getMessage();
  }
 }
 return exception.getMessage();
}
origin: iterate-ch/cyberduck

@Override
public void onFailure(final GoogleJsonError e, final HttpHeaders responseHeaders) {
  log.warn(String.format("Failure deleting %s. %s", file, e.getMessage()));
  failures.add(new HttpResponseExceptionMappingService().map(
    new HttpResponseException(e.getCode(), e.getMessage())));
}
origin: com.google.cloud.bigdataoss/util

/** Extracts the error message. */
public String getErrorMessage(IOException e) {
 // Prefer to use message from GJRE.
 GoogleJsonResponseException gjre = getJsonResponseExceptionOrNull(e);
 if (gjre != null && gjre.getDetails() != null) {
  return gjre.getDetails().getMessage();
 }
 return e.getMessage();
}
origin: GoogleCloudPlatform/bigdata-interop

/** Extracts the error message. */
public String getErrorMessage(IOException e) {
 // Prefer to use message from GJRE.
 GoogleJsonResponseException gjre = getJsonResponseExceptionOrNull(e);
 if (gjre != null && gjre.getDetails() != null) {
  return gjre.getDetails().getMessage();
 }
 return e.getMessage();
}
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: GoogleCloudPlatform/google-cloud-intellij

private static String resolveJsonResponseToMessage(GoogleJsonResponseException reason) {
 switch (reason.getStatusCode()) {
  case 403:
   return StackdriverDebuggerBundle.message("clouddebug.debug.targets.accessdenied");
  default:
   return StackdriverDebuggerBundle.getString(
     "clouddebug.debug.targets.error", reason.getDetails().getMessage());
 }
}
origin: com.jdroidtools/jdroid-java-googleplay-publisher

public static List<Track> getTracks(App app) {
  try {
    Edits edits = init(app.getAppContext()).edits();
    AppEdit edit = createEdit(app, edits);
    return edits.tracks().list(app.getApplicationId(), edit.getId()).execute().getTracks();
  } catch (GoogleJsonResponseException ex) {
    throw new RuntimeException(ex.getDetails().getMessage(), ex);
  } catch (IOException ex) {
    throw new RuntimeException(ex);
  }
}

com.google.api.client.googleapis.jsonGoogleJsonErrorgetMessage

Javadoc

Returns the human-readable explanation of the error or null for none.

Popular methods of GoogleJsonError

  • getCode
    Returns the HTTP status code of this response or null for none.
  • <init>
  • getErrors
    Returns the list of detailed errors or null for none.
  • 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