diff --git a/src/content/content.ts b/src/content/content.ts
index 9d0afae..ab5e4b4 100644
--- a/src/content/content.ts
+++ b/src/content/content.ts
@@ -208,7 +208,24 @@ async function inject() {
const priceRows: PriceRow[]= [];
// Get current key price
- const keyPrice = await fetchKeyPrice(token);
+ let keyPrice: ItemPriceData
+ try {
+ keyPrice = await fetchKeyPrice(token);
+ } catch (error) {
+ logError('Failed to get a key price from prices.tf: ' + error);
+ // Footer row
+ const row = document.createElement("tr");
+
+ const label = document.createElement("td");
+ label.colSpan = 2;
+ label.style.fontSize = "85%";
+ label.style.textAlign = "center";
+ label.innerHTML = `Failed to get prices from prices.tf. Service may be down.`;
+ row.appendChild(label);
+ priceProgressRow.insertAdjacentElement('afterend', row);
+ priceProgressRow.remove();
+ return
+ }
const currentTime = new Date()
@@ -404,7 +421,7 @@ async function inject() {
label.colSpan = 2;
label.style.fontSize = "85%";
label.style.textAlign = "center";
- const updateText = $T("Updated %@.", locale).replace('%@', updateTime.toLocaleString(locale, { year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit', timeZoneName: 'short' }))
+ const updateText = $T("Updated %@", locale).replace('%@', updateTime.toLocaleString(locale, { year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit', timeZoneName: 'short' }))
const attributionHeader = $T("Acknowledgements");
const pricesAttribution = `prices.tf`;
const exchangeRateAttribution = `Rates By Exchange Rate API`;