diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2022-11-28 21:15:34 -0600 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-12-02 22:59:44 +0100 |
commit | dc7816aa8c6a1e023a33fe15b2ef99a0c5ac551f (patch) | |
tree | fe38d2f485cd8f1bc7994293153569dc0b4d3447 | |
parent | 43b18fe6cebee54a423a9463c5c839e8f4ed2fcf (diff) | |
download | aerc-dc7816aa8c6a1e023a33fe15b2ef99a0c5ac551f.tar.gz |
imap: simplify error handling in list directories
Simplify the error handling in ListDirectories so the Done message is
not within an else statement
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r-- | worker/imap/list.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/worker/imap/list.go b/worker/imap/list.go index e02d7cbb..a03468ab 100644 --- a/worker/imap/list.go +++ b/worker/imap/list.go @@ -32,17 +32,18 @@ func (imapw *IMAPWorker) handleListDirectories(msg *types.ListDirectories) { done <- nil }() - if err := imapw.client.List("", "*", mailboxes); err != nil { + err := imapw.client.List("", "*", mailboxes) + if err != nil { <-done imapw.worker.PostMessage(&types.Error{ Message: types.RespondTo(msg), Error: err, }, nil) - } else { - <-done - imapw.worker.PostMessage( - &types.Done{Message: types.RespondTo(msg)}, nil) + return } + <-done + imapw.worker.PostMessage( + &types.Done{Message: types.RespondTo(msg)}, nil) } func canOpen(mbox *imap.MailboxInfo) bool { |