summaryrefslogtreecommitdiffstats
path: root/models/activities/action.go
diff options
context:
space:
mode:
authordelvh <leon@kske.dev>2022-10-24 21:29:17 +0200
committerGitHub <noreply@github.com>2022-10-24 20:29:17 +0100
commit0ebb45cfe7606adf021ad359d6fbfcefc54360a5 (patch)
tree541b75d083213e93bbbfadbdc5d560c739543903 /models/activities/action.go
parent7c11a73833f3aa9783015e5e13871d3c298d3ef6 (diff)
downloadgitea-0ebb45cfe7606adf021ad359d6fbfcefc54360a5.tar.gz
gitea-0ebb45cfe7606adf021ad359d6fbfcefc54360a5.zip
Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551)
Found using `find . -type f -name '*.go' -print -exec vim {} -c ':%s/fmt\.Errorf(\(.*\)%v\(.*\)err/fmt.Errorf(\1%w\2err/g' -c ':wq' \;` Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'models/activities/action.go')
-rw-r--r--models/activities/action.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/models/activities/action.go b/models/activities/action.go
index 3c8acb5ba8..147511edec 100644
--- a/models/activities/action.go
+++ b/models/activities/action.go
@@ -359,11 +359,11 @@ func GetFeeds(ctx context.Context, opts GetFeedsOptions) (ActionList, error) {
actions := make([]*Action, 0, opts.PageSize)
if err := sess.Desc("`action`.created_unix").Find(&actions); err != nil {
- return nil, fmt.Errorf("Find: %v", err)
+ return nil, fmt.Errorf("Find: %w", err)
}
if err := ActionList(actions).loadAttributes(ctx); err != nil {
- return nil, fmt.Errorf("LoadAttributes: %v", err)
+ return nil, fmt.Errorf("LoadAttributes: %w", err)
}
return actions, nil
@@ -415,7 +415,7 @@ func activityQueryCondition(opts GetFeedsOptions) (builder.Cond, error) {
env := organization.OrgFromUser(opts.RequestedUser).AccessibleTeamReposEnv(opts.RequestedTeam)
teamRepoIDs, err := env.RepoIDs(1, opts.RequestedUser.NumRepos)
if err != nil {
- return nil, fmt.Errorf("GetTeamRepositories: %v", err)
+ return nil, fmt.Errorf("GetTeamRepositories: %w", err)
}
cond = cond.And(builder.In("repo_id", teamRepoIDs))
}
@@ -477,14 +477,14 @@ func notifyWatchers(ctx context.Context, actions ...*Action) error {
// Add feeds for user self and all watchers.
watchers, err = repo_model.GetWatchers(ctx, act.RepoID)
if err != nil {
- return fmt.Errorf("get watchers: %v", err)
+ return fmt.Errorf("get watchers: %w", err)
}
}
// Add feed for actioner.
act.UserID = act.ActUserID
if _, err = e.Insert(act); err != nil {
- return fmt.Errorf("insert new actioner: %v", err)
+ return fmt.Errorf("insert new actioner: %w", err)
}
if repoChanged {
@@ -493,7 +493,7 @@ func notifyWatchers(ctx context.Context, actions ...*Action) error {
// check repo owner exist.
if err := act.Repo.GetOwner(ctx); err != nil {
- return fmt.Errorf("can't get repo owner: %v", err)
+ return fmt.Errorf("can't get repo owner: %w", err)
}
} else if act.Repo == nil {
act.Repo = repo
@@ -504,7 +504,7 @@ func notifyWatchers(ctx context.Context, actions ...*Action) error {
act.ID = 0
act.UserID = act.Repo.Owner.ID
if err = db.Insert(ctx, act); err != nil {
- return fmt.Errorf("insert new actioner: %v", err)
+ return fmt.Errorf("insert new actioner: %w", err)
}
}
@@ -557,7 +557,7 @@ func notifyWatchers(ctx context.Context, actions ...*Action) error {
}
if err = db.Insert(ctx, act); err != nil {
- return fmt.Errorf("insert new action: %v", err)
+ return fmt.Errorf("insert new action: %w", err)
}
}
}