diff options
author | Koni Marti <koni.marti@gmail.com> | 2022-10-02 11:36:05 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-10-02 18:56:26 +0200 |
commit | dc299cc8adda5c9fb7a0f6a7719f3e2cd0f1f443 (patch) | |
tree | 5a3e0ded9d72ae0eafa3440e2ee1c88109d9c21a /worker/mbox | |
parent | 020279108c4234974a26580183ef60945c5bd5cb (diff) | |
download | aerc-dc299cc8adda5c9fb7a0f6a7719f3e2cd0f1f443.tar.gz |
logging: substitute %w for %v
Subsitute the format specifier %w for %v in the logging facility. The
logging functions use a fmt.Sprintf call behind the scene which does not
recognize %w. %w should be used in fmt.Errorf when you want to wrap
errors. Hence, the log entries that use %w are improperly formatted like
this:
ERROR 2022/10/02 09:13:57.724529 worker.go:439: could not get message
info %!w(*fmt.wrapError=&{could not get structure: [snip] })
^
Links: https://go.dev/blog/go1.13-errors
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
Diffstat (limited to 'worker/mbox')
-rw-r--r-- | worker/mbox/worker.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/worker/mbox/worker.go b/worker/mbox/worker.go index 10a94cdc..a786a65e 100644 --- a/worker/mbox/worker.go +++ b/worker/mbox/worker.go @@ -167,7 +167,7 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error { case *types.FetchMessageBodyPart: m, err := w.folder.Message(msg.Uid) if err != nil { - logging.Errorf("could not get message %d: %w", msg.Uid, err) + logging.Errorf("could not get message %d: %v", msg.Uid, err) reterr = err break } @@ -205,18 +205,18 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error { for _, uid := range msg.Uids { m, err := w.folder.Message(uid) if err != nil { - logging.Errorf("could not get message for uid %d: %w", uid, err) + logging.Errorf("could not get message for uid %d: %v", uid, err) continue } r, err := m.NewReader() if err != nil { - logging.Errorf("could not get message reader: %w", err) + logging.Errorf("could not get message reader: %v", err) continue } defer r.Close() b, err := io.ReadAll(r) if err != nil { - logging.Errorf("could not get message reader: %w", err) + logging.Errorf("could not get message reader: %v", err) continue } w.worker.PostMessage(&types.FullMessage{ @@ -251,16 +251,16 @@ func (w *mboxWorker) handleMessage(msg types.WorkerMessage) error { for _, uid := range msg.Uids { m, err := w.folder.Message(uid) if err != nil { - logging.Errorf("could not get message: %w", err) + logging.Errorf("could not get message: %v", err) continue } if err := m.(*message).SetFlag(msg.Flag, msg.Enable); err != nil { - logging.Errorf("could change flag %v to %t on message: %w", msg.Flag, msg.Enable, err) + logging.Errorf("could change flag %v to %t on message: %v", msg.Flag, msg.Enable, err) continue } info, err := lib.MessageInfo(m) if err != nil { - logging.Errorf("could not get message info: %w", err) + logging.Errorf("could not get message info: %v", err) continue } @@ -397,12 +397,12 @@ func sortUids(folder *container, uids []uint32, for _, uid := range uids { m, err := folder.Message(uid) if err != nil { - logging.Errorf("could not get message %w", err) + logging.Errorf("could not get message %v", err) continue } info, err := lib.MessageInfo(m) if err != nil { - logging.Errorf("could not get message info %w", err) + logging.Errorf("could not get message info %v", err) continue } infos = append(infos, info) |