mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-02-01 08:04:07 +00:00
Handle catalog empty (#2082)
Handle UI errors caused by Catalog API calls returning no offering id.
This commit is contained in:
@@ -197,6 +197,11 @@ export const getPriceMapAndCurrencyCode = async (map: OfferingIdMap): Promise<Pr
|
||||
const priceMap = new Map<string, Map<string, number>>();
|
||||
let billingCurrency;
|
||||
for (const region of map.keys()) {
|
||||
// if no offering id is found for that region, skipping calling price API
|
||||
const subMap = map.get(region);
|
||||
if (!subMap || subMap.size === 0) {
|
||||
continue;
|
||||
}
|
||||
const regionPriceMap = new Map<string, number>();
|
||||
const regionShortName = await getRegionShortName(region);
|
||||
const requestBody: OfferingIdRequest = {
|
||||
@@ -237,7 +242,7 @@ export const getPriceMapAndCurrencyCode = async (map: OfferingIdMap): Promise<Pr
|
||||
} catch (err) {
|
||||
const failureTelemetry = { err, selfServeClassName: SqlX.name };
|
||||
selfServeTraceFailure(failureTelemetry, getPriceMapAndCurrencyCodeTimestamp);
|
||||
return { priceMap: undefined, billingCurrency: undefined };
|
||||
return { priceMap: new Map<string, Map<string, number>>(), billingCurrency: undefined };
|
||||
}
|
||||
};
|
||||
|
||||
@@ -286,6 +291,6 @@ export const getOfferingIds = async (regions: Array<RegionItem>): Promise<Offeri
|
||||
} catch (err) {
|
||||
const failureTelemetry = { err, selfServeClassName: SqlX.name };
|
||||
selfServeTraceFailure(failureTelemetry, getOfferingIdsCodeTimestamp);
|
||||
return undefined;
|
||||
return new Map<string, Map<string, string>>();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user