diff --git a/src/shared/github-api-availability.test.ts b/src/shared/github-api-availability.test.ts index 1b104525e46..df34de85940 100644 --- a/src/shared/github-api-availability.test.ts +++ b/src/shared/github-api-availability.test.ts @@ -20,6 +20,7 @@ describe('classifyGitHubUnavailable', () => { 'connect ETIMEDOUT 140.82.112.5:443', 'TimeoutError: request aborted', 'NetworkError when attempting to fetch resource', + 'network unavailable', 'fetch failed', 'socket hang up', 'could not resolve host: api.github.com', @@ -41,6 +42,11 @@ describe('classifyGitHubUnavailable', () => { expect(classifyGitHubUnavailable('HTTP 403: Resource not accessible by integration')).toBeNull() expect(classifyGitHubUnavailable('HTTP 404: Not Found')).toBeNull() expect(classifyGitHubUnavailable('could not resolve to a Repository with the name')).toBeNull() + expect( + classifyGitHubUnavailable( + "GraphQL: Could not resolve to a Repository with the name 'network'." + ) + ).toBeNull() expect(classifyGitHubUnavailable('gh auth login required')).toBeNull() expect(classifyGitHubUnavailable('')).toBeNull() }) diff --git a/src/shared/github-api-availability.ts b/src/shared/github-api-availability.ts index b44b1ea4d47..83d59ae9fed 100644 --- a/src/shared/github-api-availability.ts +++ b/src/shared/github-api-availability.ts @@ -23,7 +23,7 @@ const SERVER_ERROR_PATTERN = // both Node (ENOTFOUND/ECONNRESET) and the gh Go client ("dial tcp", "i/o // timeout", "no such host") shapes. const NETWORK_PATTERN = - /timeout|\btimed out\b|\bno such host\b|could not resolve host|could not resolve to a host|network|\bconnection (?:refused|reset)\b|\bdial tcp\b|\bi\/o timeout\b|\bfetch failed\b|\bsocket hang up\b|ENOTFOUND|ECONNRESET|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|ENETUNREACH/i + /timeout|\btimed out\b|\bno such host\b|could not resolve host|could not resolve to a host|\bnetwork(?:error| (?:error|unavailable|unreachable|request failed))\b|\bconnection (?:refused|reset)\b|\bdial tcp\b|\bi\/o timeout\b|\bfetch failed\b|\bsocket hang up\b|ENOTFOUND|ECONNRESET|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|ENETUNREACH/i /** * Classify a gh/Octokit error message as a GitHub-reachability problem, or