exception documentation

class FieldError(ValueError, TypeError):

Constructor: FieldError(field, reason)

View In Hierarchy

A TOML value does not fit the field it was written under.

Both a ValueError and a TypeError, since the conversion raises either. It adds which field, so a caller reading a whole file can report the place and carry on.

Method __init__ Remember the field and the reason, and say both.
Instance Variable field The field name, dotted when the value sat inside a nested table.
Instance Variable reason What was wrong with the value, without the field name.
def __init__(self, field: str, reason: str):

Remember the field and the reason, and say both.

field =

The field name, dotted when the value sat inside a nested table.

reason =

What was wrong with the value, without the field name.