diff --git a/extensions/github-authentication/src/githubServer.ts b/extensions/github-authentication/src/githubServer.ts index 2f263991de8..91503c3a12e 100644 --- a/extensions/github-authentication/src/githubServer.ts +++ b/extensions/github-authentication/src/githubServer.ts @@ -97,8 +97,18 @@ async function getUserInfo(token: string, serverUri: vscode.Uri, logger: Log): P logger.info('Got account info!'); return { id: json.id, accountName: json.login }; } else { - logger.error(`Getting account info failed: ${result.statusText}`); - throw new Error(result.statusText); + // either display the response message or the http status text + let errorMessage = result.statusText; + try { + const json = await result.json(); + if (json.message) { + errorMessage = json.message; + } + } catch (err) { + // noop + } + logger.error(`Getting account info failed: ${errorMessage}`); + throw new Error(errorMessage); } }