Skip to content

Commit

Permalink
avoid-errors-when-no-organization (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielsoltz authored Nov 19, 2023
1 parent f29a227 commit 66f7fc2
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions lib/context/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,20 @@ def get_account_organizations(self):
"OU": organizations_ou,
}
except ClientError as err:
self.logger.error(
"Failed to describe_account: %s, for resource: %s - %s",
self.resource_account_id,
self.resource_arn,
err,
)
if err.response["Error"]["Code"] == "AWSOrganizationsNotInUseException":
self.logger.info(
"Failed to describe_account: %s, for resource: %s - %s",
self.resource_account_id,
self.resource_arn,
err,
)
else:
self.logger.warning(
"Failed to describe_account: %s, for resource: %s - %s",
self.resource_account_id,
self.resource_arn,
err,
)

return organizations

Expand Down

0 comments on commit 66f7fc2

Please sign in to comment.