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

Modify run_with_result() to return Result<(), Box<dyn std::error::Error>> #79

Merged
merged 8 commits into from
Dec 4, 2023

Conversation

timburks
Copy link
Contributor

@timburks timburks commented Dec 2, 2023

Addresses #78

This eliminates the ActionResult type and moves ActionError into the error.rs file alongside FlagError. To allow it to be returned in Box<> values, ActionError is a struct with an associated enum ActionErrorKind. This is different from FlagError, which is an enum, and for consistency we may want to rename FlagError to FlagErrorKind and add a new FlagError struct that is similar to ActionError.

This is a breaking change from v2.2.0 but only in the types returned by run_with_result and the functions of type ActionWithResult. I think it is worth making this change for consistency with general Rust best practices, as described in Recoverable Errors with Result.

@timburks timburks marked this pull request as draft December 2, 2023 17:42
@timburks timburks changed the title Rename ActionResult and ActionError to Result and Error. Modify run_with_result() to return Result<(), Box<dyn std::error::Error> Dec 2, 2023
@timburks timburks marked this pull request as ready for review December 2, 2023 21:43
@timburks timburks changed the title Modify run_with_result() to return Result<(), Box<dyn std::error::Error> Modify run_with_result() to return Result<(), Box<dyn std::error::Error>> Dec 3, 2023
@ksk001100
Copy link
Owner

@timburks
LGTM

@ksk001100 ksk001100 merged commit 34c897a into ksk001100:master Dec 4, 2023
6 checks passed
@timburks
Copy link
Contributor Author

timburks commented Dec 4, 2023

@ksk001100 Thanks for merging! For future PRs, you might want to choose the "squash and merge" option to combine all of the commits in the PR into a single commit. I haven't been trying to minimize the number of commits in my PRs and don't want my work-in-progress commits to make your commit history ugly! :)

@ksk001100
Copy link
Owner

@timburks
Thank you for sharing the "squash and merge" option. I did not know this feature existed.

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