aws / aws/aws-secretsmanager-caching-python

Don't wrap ResourceNotFoundException

Open
#20 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
146
Forks
32
PR merge metrics
No merged PRs in 30d

Description

If the secret is not on AWS Secrets Manager the client will throw a `ResourceNotFoundException` that will be wrapped in [`SecretCacheObject.__refresh`](https://github.com/aws/aws-secretsmanager-caching-python/blob/8b3ed311982096d6cb6a99ab33299ade3c9811b3/src/aws_secretsmanager_caching/cache/items.py#L97)

I think to **wrap `ResourceNotFoundException` is not good practice**: because after the client application has no way to understand that something is wrong in the configuration of Aws SM, and if you have a hook it will be triggered anyway even if an exception occurred and the value is None.
[the implementation of `SecretCacheHook` will receive `cached_obj = None` in the get method]

Contributor guide

Open the contributing guide

Research direction

Start in src/aws_secretsmanager_caching/cache/items.py at SecretCacheObject.__refresh, then read how SecretCacheHook receives cached_obj in the get path. Confirm the current wrapping behavior for ResourceNotFoundException and define done as preserving that exception so configuration errors are distinguishable and the hook is not invoked with None.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
backend, cloud, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.