From 5ca6022d007bc83daba1e7297480d37f56554455 Mon Sep 17 00:00:00 2001 From: Moritz Poldrack Date: Fri, 29 Jul 2022 22:31:54 +0200 Subject: lint: ensure errors are at least logged (errcheck) Signed-off-by: Moritz Poldrack Acked-by: Robin Jarry --- worker/notmuch/lib/database.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'worker/notmuch/lib/database.go') diff --git a/worker/notmuch/lib/database.go b/worker/notmuch/lib/database.go index ac1a28ed..780e7ab3 100644 --- a/worker/notmuch/lib/database.go +++ b/worker/notmuch/lib/database.go @@ -234,7 +234,11 @@ func (db *DB) msgModify(key string, } defer msg.Close() - cb(msg) + err = cb(msg) + if err != nil { + logging.Warnf("callback failed: %v", err) + } + err = msg.TagsToMaildirFlags() if err != nil { logging.Errorf("could not sync maildir flags: %v", err) @@ -248,10 +252,16 @@ func (db *DB) MsgModifyTags(key string, add, remove []string) error { err := db.msgModify(key, func(msg *notmuch.Message) error { ierr := msg.Atomic(func(msg *notmuch.Message) { for _, t := range add { - msg.AddTag(t) + err := msg.AddTag(t) + if err != nil { + logging.Warnf("failed to add tag: %v", err) + } } for _, t := range remove { - msg.RemoveTag(t) + err := msg.RemoveTag(t) + if err != nil { + logging.Warnf("failed to add tag: %v", err) + } } }) return ierr -- cgit