You've already forked tf2wikipricing
fix: handle remote prices.tf error in background script
This commit is contained in:
@@ -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;
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user