Added check for webhook file existing but empty.
This commit is contained in:
parent
1fbc52f4aa
commit
4dbc6b44d4
1 changed files with 4 additions and 0 deletions
|
|
@ -14,10 +14,14 @@ class Webhooks:
|
|||
def __init__(self, file: str):
|
||||
if os.path.exists(file):
|
||||
try:
|
||||
if os.path.getsize(file) < 2:
|
||||
raise Exception(f'file is empty.')
|
||||
|
||||
log.info(f'Loading webhooks from {file}')
|
||||
with open(file, 'r') as f:
|
||||
self.targets = json.load(f)
|
||||
except Exception as e:
|
||||
log.error(f'Error loading webhooks from {file}: {e}')
|
||||
pass
|
||||
|
||||
async def send(self, event: str, item: ItemDTO) -> list[dict]:
|
||||
|
|
|
|||
Loading…
Reference in a new issue