Add fallback logic

This commit is contained in:
HarithaVattikuti 2024-12-25 22:04:41 -06:00
parent ac0b2277f9
commit 18e3bffb12
2 changed files with 16085 additions and 18317 deletions

34392
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -262,7 +262,12 @@ export class DotnetCoreInstaller {
httpClient: hc.HttpClient, httpClient: hc.HttpClient,
versionParts: string[] versionParts: string[]
): Promise<string> { ): Promise<string> {
const response = await httpClient.getJson<any>(DotNetCoreIndexUrl); let response;
try {
response = await httpClient.getJson<any>(DotNetCoreIndexUrl);
} catch (error) {
response = await httpClient.getJson<any>(DotnetCoreIndexFallbackUrl);
}
const result = response.result || {}; const result = response.result || {};
let releasesInfo: any[] = result['releases-index']; let releasesInfo: any[] = result['releases-index'];
@ -301,4 +306,7 @@ export class DotnetCoreInstaller {
} }
const DotNetCoreIndexUrl: string = const DotNetCoreIndexUrl: string =
'https://builds.dotnet.microsoft.com/dotnet/release-metadata/releases-index.json';
const DotnetCoreIndexFallbackUrl: string =
'https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json'; 'https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json';