Don't panic if sending notification fails

This commit is contained in:
Christian Muehlhaeuser 2019-06-02 08:37:08 +02:00
parent f97938d514
commit 5532064e71
No known key found for this signature in database
GPG key ID: 3CF9FA45CA1EBB7E

View file

@ -1,17 +1,23 @@
// +build linux
package main package main
import "github.com/gen2brain/beeep" import (
"fmt"
"github.com/gen2brain/beeep"
)
func notify(title string, body string) { func notify(title string, body string) {
err := beeep.Notify(title, body, "") err := beeep.Notify(title, body, "")
if err != nil { if err != nil {
panic(err) fmt.Println("Error sending notification:", err)
} }
} }
func init() { func init() {
err := beeep.Beep(beeep.DefaultFreq, beeep.DefaultDuration) err := beeep.Beep(beeep.DefaultFreq, beeep.DefaultDuration)
if err != nil { if err != nil {
panic(err) fmt.Println("Error initializing notifications:", err)
} }
} }