When querying ProjectsV2 fields we generally don't want to show the user scope errors, field does not exist errors, or authorization errors. ProjectsV2IgnorableError checks against known error strings to see if an error can be safely ignored. Due to the fact that the GraphQLClient can return multipl
(err error)
| 328 | // return multiple types of errors this uses brittle string comparison to check |
| 329 | // against the known error strings. |
| 330 | func ProjectsV2IgnorableError(err error) bool { |
| 331 | msg := err.Error() |
| 332 | if strings.Contains(msg, errorProjectsV2ReadScope) || |
| 333 | strings.Contains(msg, errorProjectsV2UserField) || |
| 334 | strings.Contains(msg, errorProjectsV2RepositoryField) || |
| 335 | strings.Contains(msg, errorProjectsV2OrganizationField) || |
| 336 | strings.Contains(msg, errorProjectsV2IssueField) || |
| 337 | strings.Contains(msg, errorProjectsV2PullRequestField) || |
| 338 | strings.Contains(msg, errorProjectsV2ResourceNotAccessible) { |
| 339 | return true |
| 340 | } |
| 341 | return false |
| 342 | } |