diff --git a/runner/pool/organization.go b/runner/pool/organization.go index 59e872c5..9acc6e8b 100644 --- a/runner/pool/organization.go +++ b/runner/pool/organization.go @@ -252,7 +252,7 @@ func (r *organization) listHooks(ctx context.Context) ([]*github.Hook, error) { hooks, ghResp, err := r.ghcli.ListOrgHooks(ctx, r.cfg.Name, &opts) if err != nil { if ghResp != nil && ghResp.StatusCode == http.StatusNotFound { - return nil, errors.Wrap(runnerErrors.ErrNotFound, "fetching hooks") + return nil, runnerErrors.NewBadRequestError("organization not found or your PAT does not have access to manage webhooks") } return nil, errors.Wrap(err, "fetching hooks") } diff --git a/runner/pool/repository.go b/runner/pool/repository.go index 8910b24d..846fbe3b 100644 --- a/runner/pool/repository.go +++ b/runner/pool/repository.go @@ -253,7 +253,7 @@ func (r *repository) listHooks(ctx context.Context) ([]*github.Hook, error) { hooks, ghResp, err := r.ghcli.ListRepoHooks(ctx, r.cfg.Owner, r.cfg.Name, &opts) if err != nil { if ghResp != nil && ghResp.StatusCode == http.StatusNotFound { - return nil, errors.Wrap(runnerErrors.ErrNotFound, "fetching hooks") + return nil, runnerErrors.NewBadRequestError("repository not found or your PAT does not have access to manage webhooks") } return nil, errors.Wrap(err, "fetching hooks") }