Skip to content

Commit 85e5951

Browse files
authored
Fix mistakes from my inferior brain (#327)
* Rename GitHubException in cog * Update GitHubException in Teams API * Update __init__.py in GitHub API with new exception naming
1 parent 3841556 commit 85e5951

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

arthur/apis/github/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from .teams import GitHubException, add_staff_member
1+
from .teams import GitHubError, add_staff_member
22

3-
__all__ = ("GitHubException", "add_staff_member")
3+
__all__ = ("GitHubError", "add_staff_member")

arthur/apis/github/teams.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
HTTP_422 = 422
1414

1515

16-
class GitHubException(Exception):
16+
class GitHubError(Exception):
1717
"""Custom exception for GitHub API errors."""
1818

1919
def __init__(self, message: str):
@@ -31,13 +31,13 @@ async def add_staff_member(username: str) -> None:
3131
except aiohttp.ClientResponseError as e:
3232
if e.status == HTTP_404:
3333
msg = f"Team or user not found: {e.message}"
34-
raise GitHubException(msg)
34+
raise GitHubError(msg)
3535
if e.status == HTTP_403:
3636
msg = f"Forbidden: {e.message}"
37-
raise GitHubException(msg)
37+
raise GitHubError(msg)
3838
if e.status == HTTP_422:
3939
msg = "Cannot add organisation as a team member"
40-
raise GitHubException(msg)
40+
raise GitHubError(msg)
4141

4242
msg = f"Unexpected error: {e.message}"
43-
raise GitHubException(msg)
43+
raise GitHubError(msg)

arthur/exts/github/management.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from discord.ext.commands import Cog, Context, group
44

5-
from arthur.apis.github import GitHubException, add_staff_member
5+
from arthur.apis.github import GitHubError, add_staff_member
66
from arthur.bot import KingArthur
77
from arthur.config import CONFIG
88

@@ -33,7 +33,7 @@ async def add_team_member(self, ctx: Context, username: str) -> None:
3333
try:
3434
await add_staff_member(username)
3535
await ctx.send(f":white_check_mark: Successfully invited {username} to the staff team.")
36-
except GitHubException as e:
36+
except GitHubError as e:
3737
await ctx.send(f":x: Failed to add {username} to the staff team: {e}")
3838

3939

0 commit comments

Comments
 (0)