pycord icon indicating copy to clipboard operation
pycord copied to clipboard

discord.error exceptions don't seem to exist

Open Luckolite opened this issue 5 years ago • 6 comments

Summary

using discord.errors.* raises an attribute error

Reproduction Steps

I wrapped a coro to fetch invites in a try/except which raises an AttributeError when reached

Minimal Reproducible Code

import discord


try:
    await guild.invites()
except discord.errors.Forbidden:
    pass

Expected Results

the code to catch the exception

Actual Results

Forbidden: 403 Forbidden (error code: 50013): Missing Permissions File "/home/luck/Fate/cogs/moderation/logger.py", line 355, in init_invites invites = await guild.invites() File "discord/guild.py", line 1997, in invites data = await self._state.http.invites_from(self.id) File "discord/http.py", line 329, in request raise Forbidden(response, data)

AttributeError: module 'discord.app.errors' has no attribute 'Forbidden' File "/home/luck/Fate/cogs/moderation/logger.py", line 358, in init_invites except discord.errors.Forbidden:

Intents

all

System Information

  • Python v3.8.10-final
  • pycord v2.0.0-alpha
    • pycord pkg_resources: v2.0.0a3832+g8c4b498e
  • aiohttp v3.6.3
  • system info: Linux 5.11.0-27-generic #29~20.04.1-Ubuntu SMP Wed Aug 11 15:58:17 UTC 2021

Checklist

  • [X] I have searched the open issues for duplicates.
  • [X] I have shown the entire traceback, if possible.
  • [X] I have removed my token from display, if visible.

Additional Context

No response

Luckolite avatar Sep 04 '21 20:09 Luckolite

Was able to reproduce. Did you find a way to fix this, seeing as you closed this issue? @FrequencyX4

BruceCodesGithub avatar Sep 05 '21 01:09 BruceCodesGithub

it looks like it was fixed in the latest commits a few hours ago

Luckolite avatar Sep 05 '21 01:09 Luckolite

It seems the bug was only fixed on the master branch. It still exists on the slash branch

Luckolite avatar Sep 05 '21 19:09 Luckolite

I yet again take that back.. it seems quite difficult to update pycord as merely pip installing the git link never truly updates it unless I uninstall first. Is that an issue on its own?

Luckolite avatar Sep 05 '21 19:09 Luckolite

I yet again take that back.. it seems quite difficult to update pycord as merely pip installing the git link never truly updates it unless I uninstall first. Is that an issue on its own?

You need the -U flag for updating it. Also can you confirm that this still a bug?

CodeWithSwastik avatar Sep 15 '21 13:09 CodeWithSwastik

-U worked when installing. it's also no longer a bug, thanks

Luckolite avatar Sep 18 '21 18:09 Luckolite