From 5532064e7133ada1971cf3a69eac4573170e007b Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sun, 2 Jun 2019 08:37:08 +0200 Subject: [PATCH] Don't panic if sending notification fails --- notifications.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/notifications.go b/notifications.go index 4226e1a..228277d 100644 --- a/notifications.go +++ b/notifications.go @@ -1,17 +1,23 @@ +// +build linux + package main -import "github.com/gen2brain/beeep" +import ( + "fmt" + + "github.com/gen2brain/beeep" +) func notify(title string, body string) { err := beeep.Notify(title, body, "") if err != nil { - panic(err) + fmt.Println("Error sending notification:", err) } } func init() { err := beeep.Beep(beeep.DefaultFreq, beeep.DefaultDuration) if err != nil { - panic(err) + fmt.Println("Error initializing notifications:", err) } }