Skip to content

fix(parameters): make GetSecretError a subclass of GetParameterError - #8612

Closed
Tanmay-Ts wants to merge 1 commit into
aws-powertools:developfrom
Tanmay-Ts:fix/get-secret-error-hierarchy
Closed

Tanmay-Ts wants to merge 1 commit into
aws-powertools:developfrom
Tanmay-Ts:fix/get-secret-error-hierarchy

Conversation

@Tanmay-Ts

Copy link
Copy Markdown

Issue number: closes #8595

Summary

Changes

  • GetSecretError now subclasses GetParameterError, matching the docstrings of get_secrets_by_name and SecretsProvider.get_multiple ("Raises GetParameterError").
  • GetSecretError is exported from aws_lambda_powertools.utilities.parameters.
  • Added a functional test asserting a SecretsProvider.get_multiple failure is caught by pytest.raises(GetParameterError).

Existing code that catches GetSecretError keeps working; this only widens what except GetParameterError catches.

User experience

Before:

from aws_lambda_powertools.utilities import parameters

try:
    parameters.get_secrets_by_name(names)
except parameters.GetParameterError:  # never reached, GetSecretError escapes
    ...

After: the except GetParameterError block catches it, and parameters.GetSecretError is importable from the package.

Tests: pytest tests/functional/parameters → 139 passed.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

🤖 Generated with Claude Code

get_secrets_by_name and SecretsProvider.get_multiple document that they
raise GetParameterError, but GetSecretError subclassed Exception, so
`except GetParameterError` missed it. Also export GetSecretError from
aws_lambda_powertools.utilities.parameters.

Closes aws-powertools#8595

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Tanmay-Ts
Tanmay-Ts requested a review from a team as a code owner October 18, 2026 15:44
@Tanmay-Ts
Tanmay-Ts requested a review from svozza October 18, 2026 15:44
@boring-cyborg

boring-cyborg Bot commented Oct 18, 2026

Copy link
Copy Markdown

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

@boring-cyborg boring-cyborg Bot added the tests label Oct 18, 2026
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 18, 2026
@sonarqubecloud

Copy link
Copy Markdown

@leandrodamascena

Copy link
Copy Markdown
Contributor

Duplicated #8611

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes 10-29 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: GetSecretError does not inherit from GetParameterError as the docstrings say

2 participants