Skip to content

Surface information from FromStr::Error when Partial::parse_from_str fails #881

@hgmich

Description

@hgmich

The downstream experience isn't great here currently; if parsing returns an error, you just get a ReflectError::OperationFailed that tells you that parsing failed, which doesn't communicate anything about why it failed.

I'm aware that this is very much a non-trivial problem; the options I can think of don't seem particularly great:

  • Allow the error type to be reflected:
    • Requires Facet be derived by the error type
    • Requires downstream users to consider how they want to handle error types
  • Impose mandatory trait bounds on FromStr::Error
    • Limits usefulness; not all FromStr::Error implement std::error::Error or Display
    • Restricts how errors may be used
  • Add additional vtable entries for FromStr where FromStr::Error: Display and/or FromStr where FromStr::Error: std::error::Error
    • Bloats VTable size when downstream users are likely to only use one variant

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions