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

Add proper error handling for conflicting flags #99

Merged

Conversation

SpyrosRoum
Copy link
Contributor

This closes #55

@marcospb19 marcospb19 merged commit 55466a3 into ouch-org:master Oct 15, 2021
@marcospb19 marcospb19 added the hacktoberfest-accepted Tag PR as accepted for the hacktoberfest event label Oct 15, 2021
@SpyrosRoum SpyrosRoum deleted the Add-proper-error-for-conflicted-flags branch October 15, 2021 14:28
@marcospb19 marcospb19 added the bugfix Fixes an existing bug label Oct 17, 2021
@marcospb19
Copy link
Member

marcospb19 commented Oct 19, 2021

One question, @SpyrosRoum, do you think that removing some error enum variants and just using FinalError for all the errors that never repeat is a bad decision?

The biggest problem in ouch's code structure in my opinion has been error treatment (for some time now), what do you think about it? Do you have any suggestions?

Asking because you have already seen how our treatment works, and I think I would need a bit of feedback before making any reasonable decision.

@SpyrosRoum
Copy link
Contributor Author

Honestly when you are making an app and not a library it doesn't often matter what the specific error is since most of the times you just want to return a nice message to the user and call it a day.
Personally when I am making an app I'd use something like anyhow or eyre.

In this particular case you can do what you said and if that's not enough then use one of the crates I mentioned earlier. You can still keep the builder pattern for the error but get rid of most of the other errors.

Btw if you need help with implementing this, or the move to clap you mentioned at some point then open an issue and let me know, I'd be happy to help.

@marcospb19
Copy link
Member

Thanks for the input!

@dlight suggested anyhow and eyre too, I ended up being inspired by the usage of user-error to create our own builder to display error with our custom syntax, error causes and the hints on how to fix it (the hints being inspired from rustc compile errors).

I'll make sure to open the issues 🙂.

@marcospb19
Copy link
Member

@SpyrosRoum #105 is now open if you wanna pick it 👍.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Fixes an existing bug hacktoberfest-accepted Tag PR as accepted for the hacktoberfest event
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add proper error message when using conflicting flags (e.g. --yes --no)
2 participants