diff --git a/api/client.go b/api/client.go index 3b6ddaf9c..3fcf0d930 100644 --- a/api/client.go +++ b/api/client.go @@ -206,7 +206,7 @@ func (err HTTPError) ScopesSuggestion() string { // ScopesSuggestion is an error messaging utility that prints the suggestion to request additional OAuth // scopes in case a server response indicates that there are missing scopes. func ScopesSuggestion(resp *http.Response) string { - if resp.StatusCode < 400 || resp.StatusCode > 499 { + if resp.StatusCode < 400 || resp.StatusCode > 499 || resp.StatusCode == 422 { return "" } diff --git a/api/client_test.go b/api/client_test.go index 415f52366..ccf911f94 100644 --- a/api/client_test.go +++ b/api/client_test.go @@ -208,6 +208,11 @@ func TestHTTPError_ScopesSuggestion(t *testing.T) { resp: makeResponse(404, "https://api.github.com/gists", "", "gist, delete_repo"), want: ``, }, + { + name: "http code is 422", + resp: makeResponse(422, "https://api.github.com/gists", "", "gist"), + want: "", + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {