From 161c2a7d853ff59ef536c22d995373207b28de70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Fedor?= Date: Mon, 5 Aug 2019 00:43:18 +0200 Subject: [PATCH] Fix SteamCommunity login warning --- js/background/background.js | 24 +++--------------------- js/content/common.js | 8 ++++---- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/js/background/background.js b/js/background/background.js index 09dbb1ee9..a61019ff7 100644 --- a/js/background/background.js +++ b/js/background/background.js @@ -442,13 +442,7 @@ class SteamCommunity extends Api { let coupons = CacheStorage.get("inventory_3", 3600); if (!coupons) { coupons = {}; - let data; - try { - data = await self.getInventory(3); - } catch(err) { - console.error(err); - return coupons; - } + let data = await self.getInventory(3); for (let description of data.descriptions) { if (!description.type || description.type !== "Coupon") { continue; } @@ -502,13 +496,7 @@ class SteamCommunity extends Api { if (!value) { let gifts = [], passes = []; - let data; - try { - data = await self.getInventory(1); - } catch(err) { - console.error(err); - return { "gifts": gifts, "passes": passes }; - } + let data = await self.getInventory(1); for (let description of data.descriptions) { let isPackage = false; @@ -556,13 +544,7 @@ class SteamCommunity extends Api { // only used for market highlighting, need to be able to return a Set() of ['market_hash_name'] let inventory = CacheStorage.get("inventory_6", 3600); if (!inventory) { - try { - inventory = await self.getInventory(6); - } catch(err) { - console.error(err); - return []; - } - + inventory = await self.getInventory(6); inventory = inventory.descriptions.map(item => item.market_hash_name); CacheStorage.set("inventory_6", inventory); } diff --git a/js/content/common.js b/js/content/common.js index 3e5302802..ce95ce347 100644 --- a/js/content/common.js +++ b/js/content/common.js @@ -1339,18 +1339,18 @@ let Inventory = (function(){ let promises = []; if (SyncedStorage.get("highlight_inv_guestpass") || SyncedStorage.get("tag_inv_guestpass") || SyncedStorage.get("highlight_inv_gift") || SyncedStorage.get("tag_inv_gift")) { - promises.push(Background.action('inventory.gifts').then(({ "gifts": x, "passes": y, }) => { gifts = new Set(x); guestpasses = new Set(y); }, EnhancedSteam.addLoginWarning)); + promises.push(Background.action('inventory.gifts').then(({ "gifts": x, "passes": y, }) => { gifts = new Set(x); guestpasses = new Set(y); })); } if (SyncedStorage.get("highlight_coupon") || SyncedStorage.get("tag_coupon") || SyncedStorage.get("show_coupon")) { - promises.push(Background.action('inventory.coupons').then(handleCoupons, EnhancedSteam.addLoginWarning)); + promises.push(Background.action('inventory.coupons').then(handleCoupons)); } if (SyncedStorage.get("highlight_owned") || SyncedStorage.get("tag_owned")) { - promises.push(Background.action('inventory.community').then(inv6 => inv6set = new Set(inv6), EnhancedSteam.addLoginWarning)); + promises.push(Background.action('inventory.community').then(inv6 => inv6set = new Set(inv6))); } - _promise = Promise.all(promises); + _promise = Promise.all(promises).catch(EnhancedSteam.addLoginWarning); return _promise; };