about summary refs log tree commit diff stats
path: root/worker/imap
diff options
context:
space:
mode:
authorBen Fiedler <git@services.bfiedler.ch>2020-04-24 16:25:13 +0200
committerDrew DeVault <sir@cmpwn.com>2020-04-24 12:59:21 -0400
commit92f59ef94af4ce936a5ea3a4407360e558317744 (patch)
treef3d5881ddfbf743f929e0cd43568a21b9ca711f3 /worker/imap
parent3102ac3680ba5fcfb126894a7b7b950b07b6c735 (diff)
downloadaerc-92f59ef94af4ce936a5ea3a4407360e558317744.tar.gz
imap/fetch.go: report error when fetching headers fails
Correct me if I'm wrong, but shouldn't this raise an error when it
fails?
Diffstat (limited to 'worker/imap')
-rw-r--r--worker/imap/fetch.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/worker/imap/fetch.go b/worker/imap/fetch.go
index bc7144c..9591ced 100644
--- a/worker/imap/fetch.go
+++ b/worker/imap/fetch.go
@@ -82,10 +82,11 @@ func (imapw *IMAPWorker) handleFetchMessages(
 			case *types.FetchMessageHeaders:
 				reader := _msg.GetBody(section)
 				textprotoHeader, err := textproto.ReadHeader(bufio.NewReader(reader))
-				var header *mail.Header
-				if err == nil {
-					header = &mail.Header{message.Header{textprotoHeader}}
+				if err != nil {
+					done <- fmt.Errorf("could not read header: %v", err)
+					return
 				}
+				header := &mail.Header{message.Header{textprotoHeader}}
 				imapw.worker.PostMessage(&types.MessageInfo{
 					Message: types.RespondTo(msg),
 					Info: &models.MessageInfo{
>161 162 163 164 165 166 167 168 169 170 171 172 173 174