Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions backend/helpers/pluginhelper/api/graphql_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func (collector *GraphqlCollector) fetchAsync(reqData *GraphqlRequestData, handl
hasNonIgnorableDataErrors := false
for _, dataError := range dataErrors {
if isIgnorableGraphqlQueryError(dataError) {
logger.Warn(nil, "Issue may have been transferred or deleted.")
logger.Warn(dataError, "skipping item that may have been transferred or deleted")
continue
}
hasNonIgnorableDataErrors = true
Expand Down Expand Up @@ -348,15 +348,16 @@ func (collector *GraphqlCollector) HasError() bool {
return len(collector.workerErrors) > 0
}

// isIgnorableGraphqlQueryError reports whether err means the queried issue no
// longer exists upstream, so its children can be skipped. GitHub and Linear
// word this differently.
// isIgnorableGraphqlQueryError reports whether err means the queried issue or
// pull request is no longer visible upstream, so it can be skipped. GitHub and
// Linear word this differently.
func isIgnorableGraphqlQueryError(err error) bool {
if err == nil {
return false
}
msg := err.Error()
return strings.Contains(msg, "Could not resolve to an Issue") ||
strings.Contains(msg, "Could not resolve to a PullRequest") ||
strings.Contains(msg, "Entity not found: Issue")
}

Expand Down
1 change: 1 addition & 0 deletions backend/helpers/pluginhelper/api/graphql_collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

func TestIsIgnorableGraphqlQueryError(t *testing.T) {
assert.True(t, isIgnorableGraphqlQueryError(errors.New("Could not resolve to an Issue with the number of 17.")))
assert.True(t, isIgnorableGraphqlQueryError(errors.New("Could not resolve to a PullRequest with the number of 5329.")))
assert.True(t, isIgnorableGraphqlQueryError(errors.New("Entity not found: Issue")))
assert.False(t, isIgnorableGraphqlQueryError(errors.New("Entity not found: Team")))
assert.False(t, isIgnorableGraphqlQueryError(errors.New("some other graphql error")))
Expand Down