From e7029616cb95058d240022b64979ba1e31466dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Mon, 25 Jul 2022 20:17:32 +0200 Subject: [PATCH] Fix parsing base repo out of outdated git remotes If any of the repositories named by git remotes could not be found via API lookup, a "could not resolve to a Repository" error would be thrown, but the goal of the base repo logic was to ignore NOT_FOUND errors. --- api/queries_repo.go | 5 +++-- pkg/cmd/status/status.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/api/queries_repo.go b/api/queries_repo.go index d63888cef..1b0f00ade 100644 --- a/api/queries_repo.go +++ b/api/queries_repo.go @@ -3,6 +3,7 @@ package api import ( "bytes" "encoding/json" + "errors" "fmt" "io" "net/http" @@ -422,8 +423,8 @@ func RepoNetwork(client *Client, repos []ghrepo.Interface) (RepoNetworkResult, e %s } `, strings.Join(queries, "")), nil, &graphqlResult) - graphqlError, isGraphQLError := err.(*GraphQLError) - if isGraphQLError { + var graphqlError GraphQLError + if errors.As(err, &graphqlError) { // If the only errors are that certain repositories are not found, // continue processing this response instead of returning an error tolerated := true diff --git a/pkg/cmd/status/status.go b/pkg/cmd/status/status.go index 7a19d07dd..69a53686e 100644 --- a/pkg/cmd/status/status.go +++ b/pkg/cmd/status/status.go @@ -441,7 +441,7 @@ func (s *StatusGetter) LoadSearchResults() error { if len(gqlErrors) == 0 { err = nil } else { - err = &api.GraphQLError{ + err = api.GraphQLError{ GQLError: ghAPI.GQLError{ Errors: gqlErrors, },