@@ -9,12 +9,13 @@ import (
99)
1010
1111const (
12- errorProjectsV2ReadScope = "field requires one of the following scopes: ['read:project']"
13- errorProjectsV2UserField = "Field 'projectsV2' doesn't exist on type 'User'"
14- errorProjectsV2RepositoryField = "Field 'projectsV2' doesn't exist on type 'Repository'"
15- errorProjectsV2OrganizationField = "Field 'projectsV2' doesn't exist on type 'Organization'"
16- errorProjectsV2IssueField = "Field 'projectItems' doesn't exist on type 'Issue'"
17- errorProjectsV2PullRequestField = "Field 'projectItems' doesn't exist on type 'PullRequest'"
12+ errorProjectsV2ReadScope = "field requires one of the following scopes: ['read:project']"
13+ errorProjectsV2UserField = "Field 'projectsV2' doesn't exist on type 'User'"
14+ errorProjectsV2RepositoryField = "Field 'projectsV2' doesn't exist on type 'Repository'"
15+ errorProjectsV2OrganizationField = "Field 'projectsV2' doesn't exist on type 'Organization'"
16+ errorProjectsV2IssueField = "Field 'projectItems' doesn't exist on type 'Issue'"
17+ errorProjectsV2PullRequestField = "Field 'projectItems' doesn't exist on type 'PullRequest'"
18+ errorProjectsV2ResourceNotAccessible = "Resource not accessible by"
1819)
1920
2021type ProjectV2 struct {
@@ -321,18 +322,20 @@ func CurrentUserProjectsV2(client *Client, hostname string) ([]ProjectV2, error)
321322}
322323
323324// When querying ProjectsV2 fields we generally don't want to show the user
324- // scope errors and field does not exist errors. ProjectsV2IgnorableError
325- // checks against known error strings to see if an error can be safely ignored.
326- // Due to the fact that the GraphQLClient can return multiple types of errors
327- // this uses brittle string comparison to check against the known error strings.
325+ // scope errors, field does not exist errors, or authorization errors.
326+ // ProjectsV2IgnorableError checks against known error strings to see if an
327+ // error can be safely ignored. Due to the fact that the GraphQLClient can
328+ // return multiple types of errors this uses brittle string comparison to check
329+ // against the known error strings.
328330func ProjectsV2IgnorableError (err error ) bool {
329331 msg := err .Error ()
330332 if strings .Contains (msg , errorProjectsV2ReadScope ) ||
331333 strings .Contains (msg , errorProjectsV2UserField ) ||
332334 strings .Contains (msg , errorProjectsV2RepositoryField ) ||
333335 strings .Contains (msg , errorProjectsV2OrganizationField ) ||
334336 strings .Contains (msg , errorProjectsV2IssueField ) ||
335- strings .Contains (msg , errorProjectsV2PullRequestField ) {
337+ strings .Contains (msg , errorProjectsV2PullRequestField ) ||
338+ strings .Contains (msg , errorProjectsV2ResourceNotAccessible ) {
336339 return true
337340 }
338341 return false
0 commit comments