diff --git a/src/background/background.ts b/src/background/background.ts index 1798bd1..86a1789 100644 --- a/src/background/background.ts +++ b/src/background/background.ts @@ -78,6 +78,9 @@ async function priceUsingPricesTF(token: string, sku: string, retries: number = throw new Error(`Cloudflare rate limit exceeded, stopping`) } } + if (!response.ok) { + throw new Error(`Pricing request for ${sku} failed with status code: ${response.status}`); + } const data = await response.json(); const prices = new PricesResponse(); prices.keys = data['sellKeys'] @@ -100,7 +103,8 @@ chrome.runtime.onMessage.addListener( priceUsingPricesTF(token, sku) .then((response) => sendResponse(response)) .catch(error => { - sendResponse(error); + console.error(`Received "${error}" error while pricing ${sku} using prices.tf`) + sendResponse(null); return false; }) }