aboutsummaryrefslogtreecommitdiffstats
path: root/worker
diff options
context:
space:
mode:
Diffstat (limited to 'worker')
-rw-r--r--worker/imap/fetch.go5
-rw-r--r--worker/maildir/worker.go2
-rw-r--r--worker/mbox/worker.go2
-rw-r--r--worker/notmuch/worker.go4
-rw-r--r--worker/types/worker.go15
5 files changed, 20 insertions, 8 deletions
diff --git a/worker/imap/fetch.go b/worker/imap/fetch.go
index d675ed17..79c9148b 100644
--- a/worker/imap/fetch.go
+++ b/worker/imap/fetch.go
@@ -50,10 +50,7 @@ func (imapw *IMAPWorker) handleFetchMessageHeaders(
if err != nil {
logging.Errorf(
"message %d: could not read header: %v", _msg.Uid, err)
- imapw.worker.PostMessage(&types.Error{
- Message: types.RespondTo(msg),
- Error: err,
- }, nil)
+ imapw.worker.PostMessageInfoError(msg, _msg.Uid, err)
return nil
}
header := &mail.Header{Header: message.Header{Header: textprotoHeader}}
diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go
index 0ece323b..d0619ad4 100644
--- a/worker/maildir/worker.go
+++ b/worker/maildir/worker.go
@@ -479,7 +479,7 @@ func (w *Worker) handleFetchMessageHeaders(
info, err := w.msgInfoFromUid(uid)
if err != nil {
logging.Errorf("could not get message info: %w", err)
- w.err(msg, err)
+ w.worker.PostMessageInfoError(msg, uid, err)
continue
}
w.worker.PostMessage(&types.MessageInfo{
diff --git a/worker/mbox/worker.go b/worker/mbox/worker.go
index c5c70821..10a94cdc 100644
--- a/worker/mbox/worker.go
+++ b/worker/mbox/worker.go
@@ -152,7 +152,7 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error {
}
msgInfo, err := lib.MessageInfo(m)
if err != nil {
- reterr = err
+ w.worker.PostMessageInfoError(msg, uid, err)
break
} else {
w.worker.PostMessage(&types.MessageInfo{
diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go
index 903460eb..2c8cc4f2 100644
--- a/worker/notmuch/worker.go
+++ b/worker/notmuch/worker.go
@@ -315,13 +315,13 @@ func (w *worker) handleFetchMessageHeaders(
m, err := w.msgFromUid(uid)
if err != nil {
logging.Errorf("could not get message: %w", err)
- w.err(msg, err)
+ w.w.PostMessageInfoError(msg, uid, err)
continue
}
err = w.emitMessageInfo(m, msg)
if err != nil {
logging.Errorf("could not emit message info: %w", err)
- w.err(msg, err)
+ w.w.PostMessageInfoError(msg, uid, err)
continue
}
}
diff --git a/worker/types/worker.go b/worker/types/worker.go
index ba396aa3..ad359494 100644
--- a/worker/types/worker.go
+++ b/worker/types/worker.go
@@ -4,6 +4,7 @@ import (
"sync/atomic"
"git.sr.ht/~rjarry/aerc/logging"
+ "git.sr.ht/~rjarry/aerc/models"
)
var lastId int64 = 1 // access via atomic
@@ -104,3 +105,17 @@ func (worker *Worker) ProcessAction(msg WorkerMessage) WorkerMessage {
}
return msg
}
+
+// PostMessageInfoError posts a MessageInfo message to the worker when an
+// error was encountered fetching the message header
+func (worker *Worker) PostMessageInfoError(msg WorkerMessage, uid uint32, err error) {
+ worker.PostMessage(&MessageInfo{
+ Info: &models.MessageInfo{
+ Envelope: &models.Envelope{},
+ Flags: []models.Flag{models.SeenFlag},
+ Uid: uid,
+ Error: err,
+ },
+ Message: RespondTo(msg),
+ }, nil)
+}