Return details in case PAT does not have access
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
c641e1d596
commit
d57e488f12
2 changed files with 2 additions and 2 deletions
|
|
@ -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")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue