Skip to content
New issue

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

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

Already on GitHub? # to your account

Handle errors when creating duration from float #70

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

naglis
Copy link
Contributor

@naglis naglis commented Jan 19, 2024

  • Use Duration::try_from_secs_f64 when parsing duration with decimal point.
  • Add new variant BadDuration to ParserError for handling the errors when the float value is not a valid duration (negative, would overflow the underlying u64 or is not a number).
  • Do not discard duration parsing errors with .ok().

- Use `try_from_secs_f64` when parsing duration with decimal point.
- Add new variant `BadDuration` to `ParserError` for handling the errors
when the float value is not a valid duration (negative, overflows the
underlying u64 or is not a number).
- Do not discard duration parsing errors with `.ok()`.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant