From 9983e95a40003629fe2b84398aaa63a9e1c33a7d Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Wed, 8 Nov 2023 18:18:17 -0800 Subject: mqtt-notify.py: Exit if message fails to show --- mqtt-notify.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'mqtt-notify.py') 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") -- cgit v1.2.3