MarriageBot icon indicating copy to clipboard operation
MarriageBot copied to clipboard

Getting orders should cleanly fail if UpgradeChat is down

Open 4Kaylum opened this issue 3 years ago • 0 comments

The bot hit a Command raised an exception: UpgradeChatError: error while running the M!adopt <@!742090647296540684> command.

Traceback (most recent call last):
  File "/home/kae/.local/lib/python3.8/site-packages/upgradechat/models.py", line 402, in get_orders
    data = await r.json()
  File "/home/kae/.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 1097, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://api.upgrade.chat/v1/orders?limit=100&offset=0&userDiscordId=753249875918848030')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/kae/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "./cogs/parentage.py", line 216, in adopt
    children_amount = await self.get_max_children_for_member(ctx.guild, ctx.author)
  File "./cogs/parentage.py", line 33, in get_max_children_for_member
    marriagebot_perks = await utils.get_marriagebot_perks(self.bot, user.id)
  File "./cogs/utils/perks_handler.py", line 66, in wrapper
    perks = await func(bot, user_id)
  File "./cogs/utils/perks_handler.py", line 98, in get_marriagebot_perks
    purchases = await asyncio.wait_for(bot.upgrade_chat.get_orders(discord_id=user_id), timeout=3)
  File "/usr/lib/python3.8/asyncio/tasks.py", line 483, in wait_for
    return fut.result()
  File "/home/kae/.local/lib/python3.8/site-packages/voxelbotutils/runner.py", line 273, in callback
    raise e
  File "/home/kae/.local/lib/python3.8/site-packages/upgradechat/models.py", line 404, in get_orders
    raise UpgradeChatError() from e
upgradechat.models.UpgradeChatError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/kae/.local/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/home/kae/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/kae/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: UpgradeChatError:

4Kaylum avatar Aug 13 '21 16:08 4Kaylum