AardWolf / aardcogs

Cogs for Discord-Red
MIT License
4 stars 4 forks source link

Sometimes untappd response may have "meta" but not "code" #151

Open AardWolf opened 5 years ago

AardWolf commented 5 years ago
[2019-09-17 18:04:50] [ERROR] red: Exception in command 'findbeer'
Traceback (most recent call last):
  File "/root/.pyenv/versions/3.7.2/lib/python3.7/site-packages/discord/ext/commands/core.py", line 79, in wrapped
    ret = await coro(*args, **kwargs)
  File "/opt/red3/cogs/CogManager/cogs/untappd/untappd.py", line 582, in findbeer
    limit=list_limit)
  File "/opt/red3/cogs/CogManager/cogs/untappd/untappd.py", line 1492, in search_beer_to_embed
    beers = await search_beer(config, ctx, query, limit)
  File "/opt/red3/cogs/CogManager/cogs/untappd/untappd.py", line 1482, in search_beer
    if resp["meta"]["code"] == 200:
TypeError: string indices must be integers

Almost certainly an error on untappd side. But we're already checking if meta is part of the response. Let's check if code is too.