Skip to content

Commit 46d1d15

Browse files
GiteaBothamkido
andauthored
Fix error handling in mailer and wiki services (#36041) (#36053)
Backport #36041 by @hamkido - 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: hamkido <hamki.do2000@gmail.com>
1 parent f164e38 commit 46d1d15

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

services/mailer/incoming/incoming.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package incoming
66
import (
77
"context"
88
"crypto/tls"
9+
"errors"
910
"fmt"
1011
net_mail "net/mail"
1112
"regexp"
@@ -221,7 +222,7 @@ loop:
221222
err := func() error {
222223
r := msg.GetBody(section)
223224
if r == nil {
224-
return fmt.Errorf("could not get body from message: %w", err)
225+
return errors.New("could not get body from message")
225226
}
226227

227228
env, err := enmime.ReadEnvelope(r)

services/wiki/wiki.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func updateWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model
137137
if hasDefaultBranch {
138138
if err := gitRepo.ReadTreeToIndex("HEAD"); err != nil {
139139
log.Error("Unable to read HEAD tree to index in: %s %v", basePath, err)
140-
return fmt.Errorf("fnable to read HEAD tree to index in: %s %w", basePath, err)
140+
return fmt.Errorf("unable to read HEAD tree to index in: %s %w", basePath, err)
141141
}
142142
}
143143

0 commit comments

Comments
 (0)