mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-04-29 03:00:45 -04:00
Add error logs to API response from GH Service (#7165)
This commit is contained in:
@@ -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]:
|
||||
|
||||
Reference in New Issue
Block a user