diff --git a/github/git_refs.go b/github/git_refs.go index fe16880e7b0..b51bcbf1deb 100644 --- a/github/git_refs.go +++ b/github/git_refs.go @@ -69,7 +69,7 @@ func (s *GitService) GetRef(ctx context.Context, owner string, repo string, ref if _, ok := err.(*json.UnmarshalTypeError); ok { // Multiple refs, means there wasn't an exact match. return nil, resp, errors.New("multiple matches found for this ref") - } else if resp.StatusCode == 404 { + } else if _, ok := err.(*ErrorResponse); ok && resp.StatusCode == 404 { // No ref, there was no match for the ref return nil, resp, errors.New("no match found for this ref") } else if err != nil {