There are various parsing functions, such as from_canonical_format and from_rfc2822. However they don't behave consistently on exceptions. They either raise InvalidFormat or ValueError, and mostly don't include a descriptive message.
Going forward, the best solution should be:
Remove InvalidFormat exception, just use ValueError everywhere.
Ensure the input string is included in a descriptive message, e.g: Could not parse as RFC3339 string: "blabla"
Ensure the type and message are properly tested for
There are various parsing functions, such as
from_canonical_format
andfrom_rfc2822
. However they don't behave consistently on exceptions. They either raiseInvalidFormat
orValueError
, and mostly don't include a descriptive message.Going forward, the best solution should be:
InvalidFormat
exception, just useValueError
everywhere.Could not parse as RFC3339 string: "blabla"