mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-24 16:40:00 +00:00
Restore improved exception handling and update test for specific httpx.HTTPStatusError
- Use httpx.HTTPStatusError for more specific exception catching - Provide better error message: 'GitHub token validation failed. Please check your token and try again.' - Update test to expect improved error message and properly mock httpx exceptions
This commit is contained in:
parent
871021adc4
commit
7f4d55f5f7
2 changed files with 7 additions and 4 deletions
|
|
@ -328,9 +328,9 @@ class GitHubTokenAuthProvider(AuthProvider):
|
|||
"""
|
||||
try:
|
||||
user_info = await _get_github_user_info(token, self.config.github_api_base_url)
|
||||
except Exception as e:
|
||||
except httpx.HTTPStatusError as e:
|
||||
logger.warning(f"GitHub token validation failed: {e}")
|
||||
raise ValueError("Invalid GitHub token") from e
|
||||
raise ValueError("GitHub token validation failed. Please check your token and try again.") from e
|
||||
|
||||
principal = user_info["user"]["login"]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue