Skip to content

Commit

Permalink
handle RestClientException from terraform-boot API for validate request
Browse files Browse the repository at this point in the history
  • Loading branch information
swaroopar committed Dec 9, 2023
1 parent c93072f commit 72f032e
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,19 @@ public DeployerKind getDeployerKind() {
@Override
public DeployValidationResult validate(Ocl ocl) {
setHeaderTokenByProfiles();
TerraformValidationResult validate =
terraformApi.validateWithScripts(getDeployWithScriptsRequest(ocl));
DeployValidationResult result = null;
try {
result = objectMapper.readValue(objectMapper.writeValueAsString(validate),
DeployValidationResult.class);
} catch (JsonProcessingException e) {
log.error("JsonProcessingException", e);
TerraformValidationResult validate =
terraformApi.validateWithScripts(getDeployWithScriptsRequest(ocl));
try {
result = objectMapper.readValue(objectMapper.writeValueAsString(validate),
DeployValidationResult.class);
} catch (JsonProcessingException e) {
log.error("JsonProcessingException", e);
}
} catch (RestClientException restClientException) {
log.error("Request to terraform-boot API failed", restClientException);
throw new TerraformBootRequestFailedException(restClientException.getMessage());
}
return result;
}
Expand Down

0 comments on commit 72f032e

Please sign in to comment.