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 missing non_exhaustive enum variant constructors to SlashArgError #234

Closed
wants to merge 1 commit into from

Conversation

webmsgr
Copy link

@webmsgr webmsgr commented Dec 30, 2023

No description provided.

@kangalio
Copy link
Collaborator

Actually, looking at this code - there was a constructor function but it was #[doc(hidden)], because I didn't intend it to be used outside the lib. For example the Parse variant is intended for poise's FromStr adapter (i.e. if a FromStr type is used as a parameter and it fails, Parse is thrown).

Why do you need to construct these framework-internal (intended as such, at least) variants in user code?

@kangalio
Copy link
Collaborator

By the way, thank you! I sometimes forget to appreciate the effort of people submitting PRs

@webmsgr
Copy link
Author

webmsgr commented Dec 30, 2023

I was using a command argument with a FromStr impl, but because the error type didn't implement Error (anyhow), I got some very confusing errors. I tried to manually implement both PopArgument and SlashArgument (which some of the errors suggested) and ran into the issue I couldn't create a SlashArgError::Parse for when the FromStr fails inside the SlashArgument impl. I've basically scrapped the whole thing and just call FromStr manually now, so feel free to close if you want.

Two of the errors pictured below:
image
image

@kangalio
Copy link
Collaborator

The FromStr error type was anyhow::Error? That's really sus. What crate is that, so I can raise an issue?

@webmsgr
Copy link
Author

webmsgr commented Dec 30, 2023

Its part of the bots source code. Its probably not the best idea, but i was already using it and didn't want to over complicate things.

@kangalio kangalio closed this Dec 30, 2023
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