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

Replace expect with a safer alternative that returns None instead #240

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

costinsin
Copy link
Contributor

Given the fact that this function returns a Result, in case of a failure, the function should either return an Err or silent fail.

When using expect, the program just panics, so none of the above situations happen.

I have replaced expect with and_then. Now the code silent fails in case time before UNIX epoch is not supported, returning None instead.

Given the fact that this function returns a `Result`, in case of a
failure, the function should either return an `Err` or silent fail.

When using `expect`, the program just panics, so none of the above
situations happen.

I have replaced `expect` with `and_then`. Now the code silent fails
in case time before UNIX epoch is not supported, returning `None` instead.

Signed-off-by: Costin-Robert Sin <sin.costinrobert@gmail.com>
@pyrossh pyrossh merged commit a735c9e into pyrossh:master Apr 5, 2024
5 checks passed
@pyrossh
Copy link
Owner

pyrossh commented Apr 5, 2024

LGTM. Thanks @costinsin

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.

2 participants