Exception subclass used for any failure to parse a datetime string. This is a subclass of :py:exc:`ValueError`, and should be raised any time earlier versions of ``dateutil`` would have raised ``ValueError``. .. versionadded:: 2.8.1
| 1581 | |
| 1582 | |
| 1583 | class ParserError(ValueError): |
| 1584 | """Exception subclass used for any failure to parse a datetime string. |
| 1585 | |
| 1586 | This is a subclass of :py:exc:`ValueError`, and should be raised any time |
| 1587 | earlier versions of ``dateutil`` would have raised ``ValueError``. |
| 1588 | |
| 1589 | .. versionadded:: 2.8.1 |
| 1590 | """ |
| 1591 | def __str__(self): |
| 1592 | try: |
| 1593 | return self.args[0] % self.args[1:] |
| 1594 | except (TypeError, IndexError): |
| 1595 | return super().__str__() |
| 1596 | |
| 1597 | def __repr__(self): |
| 1598 | args = ", ".join("'%s'" % arg for arg in self.args) |
| 1599 | return "%s(%s)" % (self.__class__.__name__, args) |
| 1600 | |
| 1601 | |
| 1602 | class UnknownTimezoneWarning(RuntimeWarning): |
no outgoing calls