scope error handling

Co-authored-by: Mislav Marohnić <mislav@github.com>
This commit is contained in:
Meijke 2021-10-15 08:35:33 -07:00 committed by GitHub
parent caa282f0ba
commit f7b4588d09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,13 +25,8 @@ func deleteRepo(client *http.Client, repo ghrepo.Interface) error {
}
defer resp.Body.Close()
err = api.HandleHTTPError(resp)
if resp.StatusCode == 403 {
return fmt.Errorf(`%w
Try authorizing the "delete_repo" scope with "gh auth refresh -s delete_repo".`, err)
} else if resp.StatusCode > 299 {
return err
if resp.StatusCode > 299 {
return api.HandleHTTPError(resp)
}
return nil