summaryrefslogtreecommitdiff
path: root/mqtt-notify.py
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2023-11-08 18:18:17 -0800
committerMatt Turner <mattst88@gmail.com>2024-05-16 23:08:42 -0400
commit9983e95a40003629fe2b84398aaa63a9e1c33a7d (patch)
treebed060819d01b0637f80b25d907ba20b42ad7807 /mqtt-notify.py
parent05bf6e8073b128eefeb1db96dd7171d8bb119595 (diff)
mqtt-notify.py: Exit if message fails to show
Diffstat (limited to 'mqtt-notify.py')
-rwxr-xr-xmqtt-notify.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/mqtt-notify.py b/mqtt-notify.py
index 5745c02..3e6bd9b 100755
--- a/mqtt-notify.py
+++ b/mqtt-notify.py
@@ -85,7 +85,11 @@ def on_message(client, userdata, msg):
n = notification_map[key][1]
n.update(subject, body, icon)
- n.show()
+ try:
+ n.show()
+ except GLib.GError as e:
+ print("Failed to show notification: {}".format(e), file=sys.stderr)
+ sys.exit(-1)
def on_disconnect(client, userdata, rc):
print("Disconnected")