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?
Post #52:
Add a
DefectsFieldfield type for collecting errors raised during parsing and decodingBy default, errors are stored as a
dictthat maps header field names to lists of exceptionsdictwith the key set to aSCANNINGorBODYenum or tokenDecoderErrorinstancesFieldDecoderError(post-alias-name, value, error)ExtraFieldsDecoderError(value, error)BodyDecoderError(value, error)Non-extra fields can now take a
required: boolparameter so that lack of a required field can be caught & registered as a defectErrors are stored after calling
.with_traceback(None)on them and their chain of causes (__cause__) & contexts (__context__) in order to reduce memory useShould defects mode be toggleable by an option when
parse*()is called?