-
Notifications
You must be signed in to change notification settings - Fork 179
Open
Description
Hi...
Love the crate...
I'd love it even more if the from_str() gave better error messages.
When I parse a file with serde I often get:
Failed: "Custom { field: \"Matching variant not found\" }"
It would be ooohhh so much better if it said:
Failed: Custom { field: \"Matching variant not found: [EnumName:'Value']\" }"
Perhaps change:
pub enum ParseError {
VariantNotFound(String),
}
...
fn from_str( s: &str, ) ...
{
...
_ => ::core::result::Result::Err(::strum::ParseError::VariantNotFound(format!("StructName[{}]", s))),
}I know it's extra overhead, but ohhh so useful.
Could make it optional and/or only in Test/Debug
Since serde does not always give a good error, even with serde_path_to_error...
Thanks
JR
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels