Skip to content

Commit

Permalink
Added additional cases for other secret manager errors
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuastegmaier committed Sep 18, 2024
1 parent dea0c05 commit d517ed9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions concordia/secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,19 @@ def get_secret(secret_name):
"The requested secret " + secret_name + " was not found"
) from e
elif e.response["Error"]["Code"] == "InvalidRequestException":
raise Exception("The request was invalid due to:", e) from e
raise Exception(
"The request for " + secret_name + "was invalid due to:", e
) from e
elif e.response["Error"]["Code"] == "InvalidParameterException":
raise Exception("The request had invalid params:", e) from e
raise Exception(
"The request for " + secret_name + "had invalid params:", e
) from e
elif e.response["Error"]["Code"] == "DecryptionFailure":
raise Exception(
"The request failed to decrypt the value for " + secret_name + ":", e
) from e
else:
raise Exception("Unknown exception:", e) from e
else:
# Decrypted secret using the associated KMS CMK Depending on whether the
# secret was a string or binary, one of these fields will be populated
Expand Down

0 comments on commit d517ed9

Please sign in to comment.