Skip to content

Commit 2e7ff10

Browse files
committed
error handling update
1 parent 8622368 commit 2e7ff10

File tree

1 file changed

+2
-2
lines changed
  • aws_sra_examples/solutions/genai/bedrock_org/lambda/rules/sra_bedrock_check_guardrails

1 file changed

+2
-2
lines changed

aws_sra_examples/solutions/genai/bedrock_org/lambda/rules/sra_bedrock_check_guardrails/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ def lambda_handler(event: dict, context: Any) -> dict: # noqa: CCR001, C901, U1
9696

9797
except bedrock.exceptions.ResourceNotFoundException:
9898
LOGGER.warning(f"Guardrail {guardrail_name} (ID: {guardrail_id}) not found")
99-
except ClientError as e:
100-
if e.response['Error']['Code'] == 'AccessDeniedException':
99+
except ClientError as client_error:
100+
if client_error.response['Error']['Code'] == 'AccessDeniedException':
101101
LOGGER.info(f"Access denied to guardrail {guardrail_name} (ID: {guardrail_id}). If guardrail uses KMS encryption, ensure Lambda's IAM role has permissions to the KMS key.")
102102
non_compliant_guardrails[guardrail_name] = ["(access_denied; see log for details)"]
103103
except Exception as e:

0 commit comments

Comments
 (0)