Skip to content

Commit 744a07b

Browse files
committed
errors.Is fix
1 parent d79f425 commit 744a07b

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

cli/cmd/digger/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ func gitHubCI(lock core_locking.Lock, policyChecker core_policy.Checker, backend
303303

304304
impactedProjects, requestedProject, prNumber, err := dg_github.ProcessGitHubEvent(ghEvent, diggerConfig, &githubPrService)
305305
if err != nil {
306-
if errors.Is(err, &dg_github.EventToIgnoreError{}) {
306+
if errors.Is(err, dg_github.UnhandledMergeGroupEventError) {
307307
reportErrorAndExit(githubActor, fmt.Sprintf("Graceful handling of GitHub event. %s", err), 0)
308308
} else {
309309
reportErrorAndExit(githubActor, fmt.Sprintf("Failed to process GitHub event. %s", err), 6)

libs/orchestrator/github/errors.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
package github
22

3-
import "fmt"
3+
import (
4+
"errors"
5+
)
46

5-
type EventToIgnoreError struct {
6-
Message string
7-
}
8-
9-
func (e *EventToIgnoreError) Error() string {
10-
return fmt.Sprintf("Unsupported event: %s", e.Message)
11-
}
7+
var UnhandledMergeGroupEventError = errors.New("vertex not found")

libs/orchestrator/github/github.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ func ProcessGitHubEvent(ghEvent interface{}, diggerConfig *digger_config.DiggerC
491491
}
492492
return nil, nil, 0, fmt.Errorf("requested project not found in modified projects")
493493
case github.MergeGroupEvent:
494-
return nil, nil, 0, &EventToIgnoreError{"ignoring event of type merge_group"}
494+
return nil, nil, 0, UnhandledMergeGroupEventError
495495
default:
496496
return nil, nil, 0, fmt.Errorf("unsupported event type")
497497
}

0 commit comments

Comments
 (0)