Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Add error logs to API response from GH Service (#7165)

Rohit Malhotraf51eb93d3ea9
diff --git a/openhands/integrations/github/github_service.py b/openhands/integrations/github/github_service.py
index 47552ef458..24b87b6ecc 100644
--- a/openhands/integrations/github/github_service.py
+++ b/openhands/integrations/github/github_service.py
@@ -14,7 +14,7 @@ from openhands.integrations.github.github_types import (
TaskType,
)
from openhands.utils.import_utils import get_impl
-
+from openhands.core.logger import openhands_logger as logger
class GitHubService:
BASE_URL = 'https://api.github.com'
@@ -80,9 +80,12 @@ class GitHubService:
except httpx.HTTPStatusError as e:
if e.response.status_code == 401:
raise GhAuthenticationError('Invalid Github token')
+
+ logger.warning(f"Status error on GH API: {e}")
raise GHUnknownException('Unknown error')
- except httpx.HTTPError:
+ except httpx.HTTPError as e:
+ logger.warning(f"HTTP error on GH API: {e}")
raise GHUnknownException('Unknown error')
async def get_user(self) -> GitHubUser:
@@ -174,9 +177,12 @@ class GitHubService:
except httpx.HTTPStatusError as e:
if e.response.status_code == 401:
raise GhAuthenticationError('Invalid Github token')
+
+ logger.warning(f"Status error on GH API: {e}")
raise GHUnknownException('Unknown error')
- except httpx.HTTPError:
+ except httpx.HTTPError as e:
+ logger.warning(f"HTTP error on GH API: {e}")
raise GHUnknownException('Unknown error')
async def get_suggested_tasks(self) -> list[SuggestedTask]: