aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author65432022-05-02 01:54:20 +0200
committerGitHub2022-05-02 01:54:20 +0200
commitf7330fd0273848eada2d509892565189295ac96b (patch)
tree148ad2bbd4e59abee3565792176de2257c86faa5
parent755d8e21ad21af6587431f99c2e46b82b05811ca (diff)
Dont overwrite err with nil (part #19572) (#19574)
* Dont overwrite err with nil (part #19572) Co-authored-by: Gusted <williamzijl7@hotmail.com>
-rw-r--r--services/pull/check.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/services/pull/check.go b/services/pull/check.go
index d9af056ea..93e539e58 100644
--- a/services/pull/check.go
+++ b/services/pull/check.go
@@ -32,8 +32,8 @@ import (
var prQueue queue.UniqueQueue
var (
- ErrIsClosed = errors.New("pull is cosed")
- ErrUserNotAllowedToMerge = errors.New("user not allowed to merge")
+ ErrIsClosed = errors.New("pull is closed")
+ ErrUserNotAllowedToMerge = models.ErrNotAllowedToMerge{}
ErrHasMerged = errors.New("has already been merged")
ErrIsWorkInProgress = errors.New("work in progress PRs cannot be merged")
ErrIsChecking = errors.New("cannot merge while conflict checking is in progress")
@@ -96,10 +96,10 @@ func CheckPullMergable(ctx context.Context, doer *user_model.User, perm *models.
if err := CheckPRReadyToMerge(pr, false); err != nil {
if models.IsErrNotAllowedToMerge(err) {
if force {
- if isRepoAdmin, err := models.IsUserRepoAdmin(pr.BaseRepo, doer); err != nil {
- return err
+ if isRepoAdmin, err2 := models.IsUserRepoAdmin(pr.BaseRepo, doer); err2 != nil {
+ return err2
} else if !isRepoAdmin {
- return ErrUserNotAllowedToMerge
+ return err
}
}
} else {