mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 02:48:30 -05:00
Touch up MSAL errors (#22906)
This commit is contained in:
@@ -327,7 +327,7 @@ export abstract class AzureAuth implements vscode.Disposable {
|
||||
|
||||
if (!resource) {
|
||||
Logger.error(`Unable to find Azure resource ${azureResource}`);
|
||||
return null;
|
||||
throw new Error(localize('msal.resourceNotFoundError', `Unable to find configuration for Azure Resource {0}`, azureResource));
|
||||
}
|
||||
|
||||
// Resource endpoint must end with '/' to form a valid scope for MSAL token request.
|
||||
@@ -336,7 +336,7 @@ export abstract class AzureAuth implements vscode.Disposable {
|
||||
let account: AccountInfo | null = await this.getAccountFromMsalCache(accountId);
|
||||
if (!account) {
|
||||
Logger.error('Error: Could not fetch account when acquiring token');
|
||||
return null;
|
||||
throw new Error(localize('msal.accountNotFoundError', `Unable to find account info when acquiring token.`));
|
||||
}
|
||||
let newScope;
|
||||
if (resource.azureResourceId === azdata.AzureResource.ResourceManagement) {
|
||||
@@ -735,7 +735,7 @@ export abstract class AzureAuth implements vscode.Disposable {
|
||||
response = await result.action(tenant.id);
|
||||
}
|
||||
|
||||
return response;
|
||||
return result?.booleanResult || response;
|
||||
}
|
||||
//#endregion
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ export class AzureAccountProvider implements azdata.AccountProvider, vscode.Disp
|
||||
}
|
||||
return token;
|
||||
} else {
|
||||
Logger.error(`MSAL: getToken call failed`);
|
||||
Logger.error(`MSAL: getToken call failed: ${authResult}`);
|
||||
// Throw error with MSAL-specific code/message, else throw generic error message
|
||||
if (this.isProviderError(authResult)) {
|
||||
throw new Error(localize('msalTokenError', `{0} occurred when acquiring token. \n{1}`, authResult.errorCode, authResult.errorMessage));
|
||||
|
||||
Reference in New Issue
Block a user