Skip to content

Commit

Permalink
[FIX] Improper use of exception (#2246)
Browse files Browse the repository at this point in the history
* adapted improper exception use

* beautified

* fixed logic error
  • Loading branch information
MFizz authored and douglascamata committed Aug 1, 2016
1 parent cc29f21 commit da73b3d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,15 +402,13 @@ def current_inventory(self):
items_stock = {x.value: 0 for x in list(Item)}

for item in inventory_dict:
try:
# print(item['inventory_item_data']['item'])
item_id = item['inventory_item_data']['item']['item_id']
item_count = item['inventory_item_data']['item']['count']
item_dict = item.get('inventory_item_data', {}).get('item', {})
item_count = item_dict.get('count')
item_id = item_dict.get('item_id')

if item_count and item_id:
if item_id in items_stock:
items_stock[item_id] = item_count
except Exception:
continue
return items_stock

def item_inventory_count(self, id):
Expand Down

0 comments on commit da73b3d

Please sign in to comment.