If I have the function,
def parse_datetime(s, **kwargs):
""" Converts a time-string into a valid
:py:class:`~datetime.datetime.DateTime` object.
Args:
s (str): string to be formatted.
``**kwargs`` is passed directly to :func:`.dateutil_parser`.
Returns:
:py:class:`~datetime.datetime.DateTime`
"""
if not s:
return None
try:
ret = dateutil_parser(s, **kwargs)
except (OverflowError, TypeError, ValueError) as e:
logger.exception(e, exc_info=True)
raise SyncthingError(*e.args)
return ret
What's the most correct way to raise the caught exception as the common library exception? (SyncthingError(Exception)
) The way it's written right now does not work correctly.