Improve the tenant logging (#20688)

* added tenant response logging

* add headers to logging

* throw error after tenant response failure
This commit is contained in:
Christopher Suh
2022-09-28 22:27:02 -07:00
committed by GitHub
parent 36dabcbd96
commit 791443ddb7

View File

@@ -368,6 +368,11 @@ export abstract class AzureAuth implements vscode.Disposable {
try {
Logger.verbose('Fetching tenants', tenantUri);
const tenantResponse = await this.makeGetRequest(tenantUri, token.token);
if (tenantResponse.status !== 200) {
Logger.error(`Error with tenant response, status: ${tenantResponse.status} | status text: ${tenantResponse.statusText}`);
Logger.error(`Headers: ${JSON.stringify(tenantResponse.headers)}`);
throw new Error('Error with tenant response');
}
const tenants: Tenant[] = tenantResponse.data.value.map((tenantInfo: TenantResponse) => {
Logger.verbose(`Tenant: ${tenantInfo.displayName}`);
return {