aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2025-07-10 14:52:57 +0100
committerGravatar GitHub <[email protected]>2025-07-10 14:52:57 +0100
commit85e5951799869074b43714ef02aa0c972c9b15cb (patch)
tree4204c96a2da4bf2da9cfcf8a30d57e8e1b0aae72
parentRename Exceptions (diff)
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
-rw-r--r--arthur/apis/github/__init__.py4
-rw-r--r--arthur/apis/github/teams.py10
-rw-r--r--arthur/exts/github/management.py4
3 files changed, 9 insertions, 9 deletions
diff --git a/arthur/apis/github/__init__.py b/arthur/apis/github/__init__.py
index 468bbe6..11261da 100644
--- a/arthur/apis/github/__init__.py
+++ b/arthur/apis/github/__init__.py
@@ -1,3 +1,3 @@
-from .teams import GitHubException, add_staff_member
+from .teams import GitHubError, add_staff_member
-__all__ = ("GitHubException", "add_staff_member")
+__all__ = ("GitHubError", "add_staff_member")
diff --git a/arthur/apis/github/teams.py b/arthur/apis/github/teams.py
index 5fcc3a0..489da90 100644
--- a/arthur/apis/github/teams.py
+++ b/arthur/apis/github/teams.py
@@ -13,7 +13,7 @@ HTTP_403 = 403
HTTP_422 = 422
-class GitHubException(Exception):
+class GitHubError(Exception):
"""Custom exception for GitHub API errors."""
def __init__(self, message: str):
@@ -31,13 +31,13 @@ async def add_staff_member(username: str) -> None:
except aiohttp.ClientResponseError as e:
if e.status == HTTP_404:
msg = f"Team or user not found: {e.message}"
- raise GitHubException(msg)
+ raise GitHubError(msg)
if e.status == HTTP_403:
msg = f"Forbidden: {e.message}"
- raise GitHubException(msg)
+ raise GitHubError(msg)
if e.status == HTTP_422:
msg = "Cannot add organisation as a team member"
- raise GitHubException(msg)
+ raise GitHubError(msg)
msg = f"Unexpected error: {e.message}"
- raise GitHubException(msg)
+ raise GitHubError(msg)
diff --git a/arthur/exts/github/management.py b/arthur/exts/github/management.py
index 202dd5b..ee3dca3 100644
--- a/arthur/exts/github/management.py
+++ b/arthur/exts/github/management.py
@@ -2,7 +2,7 @@
from discord.ext.commands import Cog, Context, group
-from arthur.apis.github import GitHubException, add_staff_member
+from arthur.apis.github import GitHubError, add_staff_member
from arthur.bot import KingArthur
from arthur.config import CONFIG
@@ -33,7 +33,7 @@ class GitHubManagement(Cog):
try:
await add_staff_member(username)
await ctx.send(f":white_check_mark: Successfully invited {username} to the staff team.")
- except GitHubException as e:
+ except GitHubError as e:
await ctx.send(f":x: Failed to add {username} to the staff team: {e}")