fix: error handling in priceSKU

This commit is contained in:
xenticore
2025-05-01 18:24:51 -04:00
parent 8d8dea0bdc
commit b84b53c544

View File

@@ -96,16 +96,21 @@ chrome.runtime.onMessage.addListener(
const sku: string = request.sku
const service: string = request.service
const token: string = request.token
switch (service) {
case "prices.tf": {
priceUsingPricesTF(token, sku).then((response) => {
sendResponse(JSON.stringify(response));
})
return true;
}
default:
if(token === "" || !token) {
sendResponse(new Error("No token provided"))
return false;
}
switch (service) {
case "prices.tf": {
priceUsingPricesTF(token, sku)
.then((response) => sendResponse({response}))
.catch(error => {
sendResponse(error);
return false;
})
}
}
return true;
}
}
);