From dd4b2ddd3aebab7b35cf1fd7e564ef60759d5bc2 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Thu, 12 Jan 2023 19:00:06 +0000 Subject: [PATCH] Log NTFY errors --- core/lib/notify.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/lib/notify.py b/core/lib/notify.py index 91ddb15..dbc4fc4 100644 --- a/core/lib/notify.py +++ b/core/lib/notify.py @@ -18,11 +18,14 @@ def raw_sendmsg(msg, title=None, priority=None, tags=None, url=None, topic=None) headers["Priority"] = priority if tags: headers["Tags"] = tags - requests.post( - f"{url}/{topic}", - data=msg, - headers=headers, - ) + try: + requests.post( + f"{url}/{topic}", + data=msg, + headers=headers, + ) + except requests.exceptions.ConnectionError as e: + log.error(f"Error sending notification: {e}") # Sendmsg helper to send a message to a user's notification settings