We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0a316bb commit 0706f09Copy full SHA for 0706f09
1 file changed
src/git/repository.ts
@@ -1,5 +1,4 @@
1
import * as vscode from "vscode";
2
-import * as dns from "dns";
3
import {Octokit} from "@octokit/rest";
4
5
import {handleSamlError} from "../api/handleSamlError";
@@ -144,8 +143,15 @@ export async function getGitHubContext(): Promise<GitHubContext | undefined> {
144
143
}
145
146
// Check internet connectivity
147
- const isConnected = !!(await dns.promises.resolve("google.com").catch(() => undefined));
148
- if (!isConnected) {
+ try {
+ const octokit = new Octokit()
+ await octokit.request('GET /', {
149
+ headers: {
150
+ 'X-GitHub-Api-Version': '2022-11-28'
151
+ }
152
+ })
153
154
+ catch {
155
logError(new Error("Cannot fetch github context, unable to connect to the internet"));
156
return undefined;
157
0 commit comments