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 <noreply@anthropic.com>
This commit is contained in:
parent
3aa0c71c32
commit
e6e8d255bd
1 changed files with 1 additions and 2 deletions
|
|
@ -3,7 +3,6 @@ package email
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
|
||||||
"net/mail"
|
"net/mail"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
|
@ -54,7 +53,7 @@ func fetchEmails(imapClient *client.Client) ([]Email, error) {
|
||||||
criteria.WithoutFlags = []string{imap.SeenFlag}
|
criteria.WithoutFlags = []string{imap.SeenFlag}
|
||||||
uids, err := imapClient.Search(criteria)
|
uids, err := imapClient.Search(criteria)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Search error: %s\n", err)
|
return nil, fmt.Errorf("search error: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(uids) > 0 {
|
if len(uids) > 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue