From a36951aef6361c0ca55cd778fe8811a7dbb4a226 Mon Sep 17 00:00:00 2001 From: hamkido Date: Fri, 28 Nov 2025 08:36:27 +0800 Subject: [PATCH] Fix error handling in mailer and wiki services (#36041) - Updated error message in `incoming.go` to remove unnecessary wrapping of the error. - Corrected typo in error message in `wiki.go` for clarity. --------- Co-authored-by: Giteabot --- services/mailer/incoming/incoming.go | 3 ++- services/wiki/wiki.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/services/mailer/incoming/incoming.go b/services/mailer/incoming/incoming.go index eade0cf271..1efaa845b8 100644 --- a/services/mailer/incoming/incoming.go +++ b/services/mailer/incoming/incoming.go @@ -6,6 +6,7 @@ package incoming import ( "context" "crypto/tls" + "errors" "fmt" net_mail "net/mail" "regexp" @@ -221,7 +222,7 @@ loop: err := func() error { r := msg.GetBody(section) if r == nil { - return fmt.Errorf("could not get body from message: %w", err) + return errors.New("could not get body from message") } env, err := enmime.ReadEnvelope(r) diff --git a/services/wiki/wiki.go b/services/wiki/wiki.go index a9dc726982..6a57a9a63e 100644 --- a/services/wiki/wiki.go +++ b/services/wiki/wiki.go @@ -135,7 +135,7 @@ func updateWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model if hasDefaultBranch { if err := gitRepo.ReadTreeToIndex("HEAD"); err != nil { log.Error("Unable to read HEAD tree to index in: %s %v", basePath, err) - return fmt.Errorf("fnable to read HEAD tree to index in: %s %w", basePath, err) + return fmt.Errorf("unable to read HEAD tree to index in: %s %w", basePath, err) } }