mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-11-29 07:16:33 +01:00
BlitzPy: add BlitzError
This commit is contained in:
16
home.admin/BlitzPy/blitzpy/exceptions.py
Normal file
16
home.admin/BlitzPy/blitzpy/exceptions.py
Normal file
@@ -0,0 +1,16 @@
|
||||
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
|
||||
Reference in New Issue
Block a user