Skip to content

chore: Simplify how timeouts are casted to an int#1518

Merged
jfuss merged 1 commit intoaws:developfrom
jfuss:simplify-timeout-int-casting
Nov 12, 2019
Merged

chore: Simplify how timeouts are casted to an int#1518
jfuss merged 1 commit intoaws:developfrom
jfuss:simplify-timeout-int-casting

Conversation

@jfuss
Copy link
Contributor

@jfuss jfuss commented Nov 11, 2019

Issue #, if available:

Description of changes:

Checklist:

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

# Guard against float values like "3.2"
if not isinstance(self.timeout, int):
raise InvalidSamTemplateException("Invalid Number for Timeout: {}".format(self.timeout))
self.timeout = int(self.timeout)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you!

Copy link
Contributor

Choose a reason for hiding this comment

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

How does this handle None / empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

int(None) raises TypeError, int('') raises ValueError

@jfuss jfuss added area/lambda-invoke area/local/start-api sam local start-api command area/local/start-lambda sam local start-lambda command area/refactor labels Nov 12, 2019
@jfuss jfuss merged commit 9f08f81 into aws:develop Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/lambda-invoke area/local/start-api sam local start-api command area/local/start-lambda sam local start-lambda command area/refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants