raspiblitz/home.admin/BlitzPy/blitzpy/exceptions.py
2020-07-19 10:30:28 +01:00

16 lines
521 B
Python

from datetime import datetime
TS_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
class BlitzError(Exception):
def __init__(self, short: str, details: dict = None, org: Exception = None):
self.short: str = str(short)
if details:
self.details: dict = details
self.details.update({'timestamp': datetime.utcnow().strftime(TS_FORMAT)})
else:
self.details = dict()
self.details['timestamp'] = datetime.utcnow().strftime(TS_FORMAT)
self.org: Exception = org