Search in sources :

Example 1 with Errors

use of com.google.api.services.compute.model.Operation.Error.Errors in project cloudbreak by hortonworks.

the class AbstractGcpResourceBuilder method checkError.

protected void checkError(Operation execute) {
    if (execute.getError() != null) {
        String msg = null;
        StringBuilder error = new StringBuilder();
        if (execute.getError().getErrors() != null) {
            for (Errors errors : execute.getError().getErrors()) {
                error.append(String.format("code: %s -> message: %s %s", errors.getCode(), errors.getMessage(), System.lineSeparator()));
            }
            msg = error.toString();
        }
        throw new CloudConnectorException(msg);
    }
}
Also used : Errors(com.google.api.services.compute.model.Operation.Error.Errors) CloudConnectorException(com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException)

Aggregations

Errors (com.google.api.services.compute.model.Operation.Error.Errors)1 CloudConnectorException (com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException)1