Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion handlers/gitlab/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ func (g GitlabProvider) ResetApprovals(projectId, mergeId int, updatedAt time.Ti
}
}

return fmt.Errorf("coudn't find commit message with updatedAt: %s", updatedAt)
return handlers.CommitNotFoundError
}

func newGitlabClient(token, instanceUrl string) *gitlab.Client {
Expand Down
12 changes: 6 additions & 6 deletions handlers/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ var (
providers = map[string]func() RequestProvider{}
providersMu sync.RWMutex

StatusError = &Error{"Is it opened?"}
ValidError = &Error{"Your request can't be merged, because either it has conflicts or state is not opened"}
RepoSizeError = &Error{"Repository size is greater than allowed size"}
NotFoundError = &Error{"Resource is not found"}
DiscussionError = &Error{"Could not find resolvable discussion for merge request"}
FeatureDisabled = &Error{"Feature is disabled"}
StatusError = &Error{"Is it opened?"}
ValidError = &Error{"Your request can't be merged, because either it has conflicts or state is not opened"}
RepoSizeError = &Error{"Repository size is greater than allowed size"}
NotFoundError = &Error{"Resource is not found"}
DiscussionError = &Error{"Could not find resolvable discussion for merge request"}
CommitNotFoundError = &Error{"Commit was not found"}
)

type Error struct {
Expand Down
8 changes: 7 additions & 1 deletion handlers/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package handlers

import (
"bytes"
"errors"
"fmt"
"html/template"
"strings"
Expand Down Expand Up @@ -261,7 +262,7 @@ func (r Request) ResetApprovals(updatedAt time.Time) error {
return nil
}

return retry.Do(
err := retry.Do(
func() error {
return r.provider.ResetApprovals(
r.info.ProjectId,
Expand All @@ -270,6 +271,11 @@ func (r Request) ResetApprovals(updatedAt time.Time) error {
},
retry.Attempts(3),
)
if !errors.Is(err, CommitNotFoundError) {
return err
}

return nil
}

func (r Request) ValidateSecret(secret string) bool {
Expand Down
Loading