Skip to content

feat: Add duration overflow check #665

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

Merged
merged 3 commits into from
Oct 6, 2023
Merged

Conversation

Techassi
Copy link
Member

@Techassi Techassi commented Oct 6, 2023

This PR adds a check when adding up different duration fragments while parsing using Duration::from_str. This function will now return an error, if the duration overflows.

Author

Preview Give feedback

Reviewer

Preview Give feedback

@Techassi Techassi self-assigned this Oct 6, 2023
@Techassi Techassi requested a review from sbernauer October 6, 2023 11:28
Copy link
Member

@sbernauer sbernauer left a comment

Choose a reason for hiding this comment

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

Code LGTM. Some tests would be great!

@Techassi
Copy link
Member Author

Techassi commented Oct 6, 2023

Code LGTM. Some tests would be great!

Yes, adding tests would indeed be nice, however it might prove a little hard to achieve that according to Duration::MAX, see here.

@Techassi Techassi added this pull request to the merge queue Oct 6, 2023
Merged via the queue into main with commit 00840ac Oct 6, 2023
@Techassi Techassi deleted the feat/duration-overflow-error branch October 6, 2023 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants