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 a field type for storing parsing defects #53

Open
jwodder opened this issue Dec 19, 2023 · 0 comments
Open

Add a field type for storing parsing defects #53

jwodder opened this issue Dec 19, 2023 · 0 comments
Labels
attrs-parser enhancement New feature or request therefor under consideration Dev has not yet decided whether or how to implement

Comments

@jwodder
Copy link
Collaborator

jwodder commented Dec 19, 2023

Post #52:

Add a DefectsField field type for collecting errors raised during parsing and decoding

  • By default, errors are stored as a dict that maps header field names to lists of exceptions

    • What should happen for scanner and body errors?
      • Idea: Don't catch scanner errors … for now
      • Idea: Store them in the dict with the key set to a SCANNING or BODY enum or token
      • Idea: Wrap all decoder errors in custom DecoderError instances
        • Subclasses:
          • FieldDecoderError(post-alias-name, value, error)
          • ExtraFieldsDecoderError(value, error)
          • BodyDecoderError(value, error)
  • Non-extra fields can now take a required: bool parameter so that lack of a required field can be caught & registered as a defect

  • Errors are stored after calling .with_traceback(None) on them and their chain of causes (__cause__) & contexts (__context__) in order to reduce memory use

  • Should defects mode be toggleable by an option when parse*() is called?

@jwodder jwodder added attrs-parser enhancement New feature or request therefor under consideration Dev has not yet decided whether or how to implement labels Dec 19, 2023
@jwodder jwodder added this to the Attrs-Based Parser milestone Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attrs-parser enhancement New feature or request therefor under consideration Dev has not yet decided whether or how to implement
Projects
None yet
Development

No branches or pull requests

1 participant