com.google.cloud.compute.ComputeException

Here are the examples of the java api class com.google.cloud.compute.ComputeException taken from open source projects.

1. DefaultComputeRpc#falseForNotFound()

Project: gcloud-java
File: DefaultComputeRpc.java
/**
   * This method returns {@code false} if the error code of {@code exception} was 404, re-throws the
   * exception otherwise.
   *
   * @throws ComputeException if the error code of {@code exception} was not 404
   */
private static boolean falseForNotFound(IOException exception) {
    ComputeException serviceException = translate(exception);
    if (serviceException.code() == HTTP_NOT_FOUND) {
        return false;
    }
    throw serviceException;
}

2. DefaultComputeRpc#nullForNotFound()

Project: gcloud-java
File: DefaultComputeRpc.java
/**
   * This method returns {@code null} if the error code of {@code exception} was 404, re-throws the
   * exception otherwise.
   *
   * @throws ComputeException if the error code of {@code exception} was not 404
   */
private static <T> T nullForNotFound(IOException exception) {
    ComputeException serviceException = translate(exception);
    if (serviceException.code() == HTTP_NOT_FOUND) {
        return null;
    }
    throw serviceException;
}