Azure auth - throw original error message (#23613)

This commit is contained in:
Cheena Malhotra
2023-06-30 15:13:39 -07:00
committed by GitHub
parent 299bd7ddbc
commit a64d3dd587

View File

@@ -150,8 +150,9 @@ export class AzureAuthCodeGrant extends AzureAuth {
return authCodeRequest;
} catch (e) {
Logger.error('MSAL: Error requesting auth code', e);
throw new AzureAuthError('error', 'Error requesting auth code', e);
let errorMessage = localize('azureAuthCodeGrant.getAuthCodeUrlError', 'An error occurred in MSAL library when requesting auth code URL. For more detailed information on error, please check \'Azure Accounts\' output pane. \n\n');
Logger.error(errorMessage);
throw new AzureAuthError(errorMessage + e.message, e.message, e);
}
}
@@ -248,18 +249,16 @@ export class AzureAuthCodeGrant extends AzureAuth {
};
let authCodeUrl = await this.clientApplication.getAuthCodeUrl(authUrlRequest);
await vscode.env.openExternal(vscode.Uri.parse(`http://localhost:${serverPort}/signin?nonce=${encodeURIComponent(this.pkceCodes.nonce)}`));
const authCode = await this.addServerListeners(server, this.pkceCodes.nonce, authCodeUrl, authCompletePromise);
authCodeRequest.code = authCode;
return authCodeRequest;
}
catch (e) {
Logger.error('MSAL: Error requesting auth code', e);
throw new AzureAuthError('error', 'Error requesting auth code', e);
let errorMessage = localize('azureAuthCodeGrant.getAuthCodeUrlError', 'An error occurred in MSAL library when requesting auth code URL. For more detailed information on error, please check \'Azure Accounts\' output pane. \n\n');
Logger.error(errorMessage);
throw new AzureAuthError(errorMessage + e.message, e.message, e);
}
}