Log partial email body read errors instead of silently ignoring
io.ReadAll errors are unlikely for short yes/no replies but worth logging for diagnosability. Processing continues with whatever bytes were read to remain resilient. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bda5ef1fcf
commit
3426d5ad3d
1 changed files with 4 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ package email
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/mail"
|
||||
"strings"
|
||||
|
||||
|
|
@ -92,6 +93,9 @@ func fetchEmails(imapClient *client.Client) ([]Email, error) {
|
|||
return result, err
|
||||
}
|
||||
body, err := io.ReadAll(m.Body)
|
||||
if err != nil {
|
||||
log.Printf("Warning: partial read of email body from %s: %s", fromAddress, err)
|
||||
}
|
||||
|
||||
email := NewEmail(
|
||||
[]string{toAddress},
|
||||
|
|
|
|||
Loading…
Reference in a new issue