From e6e8d255bdfcac2b59b235843061d7ea21fcfb0e Mon Sep 17 00:00:00 2001 From: Harry Culpan Date: Tue, 30 Jun 2026 18:34:27 -0400 Subject: [PATCH] Return IMAP search error instead of swallowing it A search failure was logged but execution continued, silently returning 'no emails' to the caller. This masked the most likely cause of the polling not working. Error now propagates so the caller can log and handle it. Co-Authored-By: Claude Sonnet 4.6 --- pkg/email/fetch.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/email/fetch.go b/pkg/email/fetch.go index d8080e2..ba3e9b5 100644 --- a/pkg/email/fetch.go +++ b/pkg/email/fetch.go @@ -3,7 +3,6 @@ package email import ( "fmt" "io" - "log" "net/mail" "strings" @@ -54,7 +53,7 @@ func fetchEmails(imapClient *client.Client) ([]Email, error) { criteria.WithoutFlags = []string{imap.SeenFlag} uids, err := imapClient.Search(criteria) if err != nil { - log.Printf("Search error: %s\n", err) + return nil, fmt.Errorf("search error: %w", err) } if len(uids) > 0 {