From 0f376bcc90e7337c6c045b24d7fbcc9d0649d532 Mon Sep 17 00:00:00 2001 From: Jcomp Date: Sat, 9 Mar 2024 04:06:29 +0800 Subject: [PATCH] Add notification error handling --- src/log.d | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/log.d b/src/log.d index b1354349..049c46ff 100644 --- a/src/log.d +++ b/src/log.d @@ -99,8 +99,13 @@ class LogBuffer { shared void notify(string message) { // Use dnotify's functionality for GUI notifications, if GUI notifications is enabled version(Notifications) { - auto n = new Notification("Log Notification", message, "IGNORED"); - n.show(); + try { + auto n = new Notification("Log Notification", message, "IGNORED"); + n.show(); + } catch (NotificationError e) { + sendGUINotification = false; + addLogEntry("Unable to send notification; disabled in the following: " ~ e.message); + } } }