Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ValueError is not caught by int() #2305

Merged
merged 2 commits into from Feb 7, 2022
Merged

fix: ValueError is not caught by int() #2305

merged 2 commits into from Feb 7, 2022

Conversation

wchengru
Copy link
Contributor

Issue #, if available:

Description of changes:

Description of how you validated changes:

Checklist:

  • Add/update tests using:
  • make pr passes
  • Update documentation
  • Verify transformed template deploys and application functions as expected

Examples?

Please reach out in the comments, if you want to add an example. Examples will be
added to sam init through https://github.com/awslabs/aws-sam-cli-app-templates/

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@@ -285,7 +285,7 @@ def _is_missing_identity_source(self, identity):
try:
ttl_int = int(ttl)
# this will catch if ttl is None and not convertable to an int
except TypeError:
except (TypeError, ValueError):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a unit test case to show when exactly this exception will be thrown?
My understanding is ValueError will be thrown if ttl value contains a non numeric value, and I think in this case we should throw a different exception

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, test cases added.

@jfuss jfuss merged commit f37ba41 into aws:develop Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants