Skip to content

Commit

Permalink
- Should return await to catch the errors. Should also no throw when …
Browse files Browse the repository at this point in the history
…there are no updates to perform.
  • Loading branch information
etiennenoel committed Oct 18, 2023
1 parent 1a5d21c commit ea0e8ea
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/aws/src/clients/cloudformation.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class CloudformationClient implements CloudformationClientInterface {
this.logHandler.debug("CLOUDFORMATION CLIENT - Creating new stack", {input}, AwsModuleKeyname);
const command = new CreateStackCommand(input)
try {
return this.getClient().send(command);
return await this.getClient().send(command);
} catch (e) {
this.logHandler.error("Error creating stack in cloudformation", {error: e}, AwsModuleKeyname);
throw e;
Expand All @@ -123,8 +123,15 @@ export class CloudformationClient implements CloudformationClientInterface {
this.logHandler.debug("CLOUDFORMATION CLIENT - Updating stack", {input}, AwsModuleKeyname);
const command = new UpdateStackCommand(input)
try {
return this.getClient().send(command);
return await this.getClient().send(command);
} catch (e) {
if(e.message == "No updates are to be performed.") {
return {
$metadata: {
httpStatusCode: 200,
}
}
}
this.logHandler.error("Error updating stack in cloudformation", {error: e}, AwsModuleKeyname);
throw e;
}
Expand All @@ -138,7 +145,7 @@ export class CloudformationClient implements CloudformationClientInterface {
this.logHandler.debug("CLOUDFORMATION CLIENT - Deleting stack", {input}, AwsModuleKeyname);
const command = new DeleteStackCommand(input)
try {
return this.getClient().send(command);
return await this.getClient().send(command);
} catch (e) {
this.logHandler.error("Error deleting stack in cloudformation", {error: e}, AwsModuleKeyname);
throw e;
Expand Down

0 comments on commit ea0e8ea

Please sign in to comment.