diff options
Diffstat (limited to 'worker')
-rw-r--r-- | worker/maildir/container.go | 8 | ||||
-rw-r--r-- | worker/maildir/worker.go | 10 |
2 files changed, 14 insertions, 4 deletions
diff --git a/worker/maildir/container.go b/worker/maildir/container.go index 946de74d..23c96617 100644 --- a/worker/maildir/container.go +++ b/worker/maildir/container.go @@ -9,6 +9,7 @@ import ( "github.com/emersion/go-maildir" "git.sr.ht/~rjarry/aerc/lib/uidstore" + "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/worker/lib" ) @@ -69,15 +70,18 @@ func (c *Container) ClearRecentFlag(uid uint32) { // UIDs fetches the unique message identifiers for the maildir func (c *Container) UIDs(d maildir.Dir) ([]uint32, error) { keys, err := d.Keys() - if err != nil { + if err != nil && len(keys) == 0 { return nil, fmt.Errorf("could not get keys for %s: %w", d, err) } + if err != nil { + log.Errorf("could not get all keys for %s: %s", d, err.Error()) + } sort.Strings(keys) var uids []uint32 for _, key := range keys { uids = append(uids, c.uids.GetOrInsert(key)) } - return uids, nil + return uids, err } // Message returns a Message struct for the given UID and maildir diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go index 5ca648c4..643ab8a9 100644 --- a/worker/maildir/worker.go +++ b/worker/maildir/worker.go @@ -236,7 +236,7 @@ func (w *Worker) getDirectoryInfo(name string) *models.DirectoryInfo { } uids, err := w.c.UIDs(dir) - if err != nil { + if err != nil && len(uids) == 0 { w.worker.Errorf("could not get uids: %v", err) return dirInfo } @@ -468,10 +468,16 @@ func (w *Worker) handleFetchDirectoryContents( } } else { uids, err = w.c.UIDs(*w.selected) - if err != nil { + if err != nil && len(uids) == 0 { w.worker.Errorf("failed scanning uids: %v", err) return err } + + if err != nil { + w.worker.PostMessage(&types.Error{ + Error: fmt.Errorf("could not get all uids for %s: %w", *w.selected, err), + }, nil) + } } sortedUids, err := w.sort(msg.Context, uids, msg.SortCriteria) if err != nil { |