From e5b9392294da21b5d14b120b80bb08bccb4ba230 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 7 Jun 2020 12:14:49 -0400 Subject: [PATCH] Convert some TODOs to log statements. --- pop3.go | 4 ++-- smtp.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pop3.go b/pop3.go index 20f94bf..a03c1b8 100644 --- a/pop3.go +++ b/pop3.go @@ -114,8 +114,8 @@ func (server *pop3Server) OpenMailbox(user, pass string) (pop3.Mailbox, error) { func (server *pop3Server) openMailbox(maildrop string) (*mailbox, error) { files, err := ioutil.ReadDir(maildrop) if err != nil { - // TODO: hide error, log instead - return nil, err + server.log.Error("failed read maildrop dir", zap.String("dir", maildrop), zap.Error(err)) + return nil, errors.New("error opening maildrop") } mb := &mailbox{ diff --git a/smtp.go b/smtp.go index 55484a2..90f0ec5 100644 --- a/smtp.go +++ b/smtp.go @@ -128,13 +128,13 @@ func (server *smtpServer) Authenticate(authz, authc, passwd string) bool { func (server *smtpServer) DeliverMessage(en smtp.Envelope) *smtp.ReplyLine { maildrop := server.maildropForAddress(en.RcptTo[0]) if maildrop == "" { - // TODO: log error + server.log.Error("faild to open maildrop to deliver message", zap.String("id", en.ID)) return &smtp.ReplyBadMailbox } f, err := os.Create(path.Join(maildrop, en.ID+".msg")) if err != nil { - // TODO: log error + server.log.Error("failed to create message file", zap.String("id", en.ID), zap.Error(err)) return &smtp.ReplyBadMailbox } -- 2.43.5