fix(notification): fail silently when notification system unavailable

Systems without a notification daemon (e.g., minimal Linux setups) would
crash when the app tried to show notifications. Now we log a warning and
continue instead of propagating the error.

Fixes #32
This commit is contained in:
vicrodh committed 2026-02-01 04:35:59 -06:00
1 parent 90e4216826
commit 4548845fbf
1 file changed
+10 -6
+10 -6
View File
@@ -158,9 +158,11 @@ pub fn show_track_notification(
} }
} }
notification // Show notification, but don't fail if notification system is unavailable
.show() // This handles systems without a notification daemon (issue #32)
.map_err(|e| format!("Failed to show notification: {}", e))?; if let Err(e) = notification.show() {
log::warn!("Could not show notification (notification system may be unavailable): {}", e);
}
Ok(()) Ok(())
} }
@@ -180,9 +182,11 @@ pub fn show_notification(
notification.body(&body_text); notification.body(&body_text);
} }
notification // Show notification, but don't fail if notification system is unavailable
.show() // This handles systems without a notification daemon (issue #32)
.map_err(|e| format!("Failed to show notification: {}", e))?; if let Err(e) = notification.show() {
log::warn!("Could not show notification (notification system may be unavailable): {}", e);
}
Ok(()) Ok(())
} }