Skip to content

Commit

Permalink
fix: add return statements to error handling in notification functions
Browse files Browse the repository at this point in the history
  • Loading branch information
revelaction committed Sep 20, 2024
1 parent 91140c8 commit ee9cf96
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 2 additions & 0 deletions notify/schedule/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func (s *Scheduler) getNotifyFunc(n notify.Notification) (func(), error) {
if err != nil {
slog.Error("🚚 Notification:", "Send?", "🛑", "📁", filepath.Base(n.EventPath), "error", err, "📌", n.Time.Format("2006-01-02 15:04:05 MST"), "type", n.Type, "source", n.Source)
fmt.Printf("Could not deliver telegram notfication: %s", err)
return
}
slog.Info("🚚 Notification:", "Send?", "✅", "📁", filepath.Base(n.EventPath), "📌", n.Time.Format("2006-01-02 15:04:05 MST"), "type", n.Type, "source", n.Source)
}
Expand All @@ -81,6 +82,7 @@ func (s *Scheduler) getNotifyFunc(n notify.Notification) (func(), error) {
err := s.desktop.Notify(n)
if err != nil {
slog.Error("🚚 Notification:", "Send?", "🛑", "📁", filepath.Base(n.EventPath), "error", err, "📌", n.Time.Format("2006-01-02 15:04:05 MST"), "type", n.Type, "source", n.Source)
return
}
slog.Info("🚚 Notification:", "Send?", "✅", "📁", filepath.Base(n.EventPath), "📌", n.Time.Format("2006-01-02 15:04:05 MST"), "type", n.Type, "source", n.Source)
}
Expand Down
1 change: 0 additions & 1 deletion notify/telegram/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func (t *Telegram) Notify(n notify.Notification) error {
var msg tg.Chattable

// If we have a image, the text is the caption.
//"https://image.tmdb.org/t/p/original/1nS8AxnoYE2Y1ANMpVKZnm8iLxP.jpg"
if n.ImageUrl != "" {
photo := tg.NewPhoto(t.config.Telegram.ChatId, tg.FileURL(n.ImageUrl))
photo.Caption = message
Expand Down

0 comments on commit ee9cf96

Please sign in to comment.