Skip to content

Error handling could be _further_ improved #108

@finnbar

Description

@finnbar

WithError is solid, but sometimes branches are missed and lead to very ugly errors. Furthermore, due to the intricacies of Maybe, we can get some very weird errors - which of the parts of the parser should error in Maybe a -> Maybe b -> c -> ... if neither of the Maybes are present?

This needs some discussion, but thoughts that came up were:

  • Default errors for parts of the SmartParser - i.e. a Text should default error with error: expecting Text that should be overridden.
  • "maybe you meant one of:" seems to be... not very clear most of the time.
  • Try to avoid "unknown error" as much as possible - maybe plugins should have a default "error in x plugin"?

I think the system of using parser names is probably unreliable (we name parsers with their error messages using <?> and slightly change the reporting system to make it clearer to users) - maybe there's other stuff in megaparsec that can help with error parsing? This needs some serious investigation, regardless.

Metadata

Metadata

Assignees

No one assigned

    Labels

    IMPORTANTThese are serious things to focus ondiscussion neededfor when an implementation is uncertainmajor

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions