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#nullForNotFound()

Project: gcloud-java
Source File: DefaultComputeRpc.java
View license
/**
   * 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;
}

2. DefaultComputeRpc#falseForNotFound()

Project: gcloud-java
Source File: DefaultComputeRpc.java
View license
/**
   * 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;
}