Skip to content

Commit a36951a

Browse files
hamkidoGiteaBot
andauthored
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 <teabot@gitea.io>
1 parent 9668913 commit a36951a

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
@@ -135,7 +135,7 @@ func updateWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model
135135
if hasDefaultBranch {
136136
if err := gitRepo.ReadTreeToIndex("HEAD"); err != nil {
137137
log.Error("Unable to read HEAD tree to index in: %s %v", basePath, err)
138-
return fmt.Errorf("fnable to read HEAD tree to index in: %s %w", basePath, err)
138+
return fmt.Errorf("unable to read HEAD tree to index in: %s %w", basePath, err)
139139
}
140140
}
141141

0 commit comments

Comments
 (0)