Add exc_info=True to OAuth error logging and endpoint-level catch in google_oauth

Agent-Logs-Url: https://github.com/christianlouis/InboxConverge/sessions/8d0fb51a-ede5-4bb7-aad8-3d29a0d3d7d3

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-05-03 17:35:49 +00:00
committed by GitHub
parent 0026afe131
commit e98c81cce4
3 changed files with 96 additions and 71 deletions
+7
View File
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<!-- version list --> <!-- version list -->
## [Unreleased]
### Fixed
- OAuth Google sign-in: added `exc_info=True` to the catch-all exception handler in `auth_service.py` so the full traceback is always emitted to the log instead of only `str(e)`.
- OAuth Google sign-in: added an endpoint-level try/except in the `/auth/google` handler to catch and log any unexpected errors (e.g. database failures) that occurred after the Google token exchange, which previously surfaced as silent 500s.
## v0.8.0 (2026-05-03) ## v0.8.0 (2026-05-03)
### Bug Fixes ### Bug Fixes
+14
View File
@@ -187,6 +187,7 @@ async def google_oauth(
auth_request.redirect_uri, auth_request.redirect_uri,
) )
try:
# Get user info from Google # Get user info from Google
user_info = await oauth_service.get_google_user_info( user_info = await oauth_service.get_google_user_info(
code=auth_request.code, redirect_uri=auth_request.redirect_uri code=auth_request.code, redirect_uri=auth_request.redirect_uri
@@ -270,6 +271,19 @@ async def google_oauth(
OAUTH_CALLBACKS_TOTAL.labels(provider="google", status="success").inc() OAUTH_CALLBACKS_TOTAL.labels(provider="google", status="success").inc()
return tokens return tokens
except HTTPException:
raise
except Exception:
OAUTH_CALLBACKS_TOTAL.labels(provider="google", status="error").inc()
logger.error(
"OAuth [Google sign-in]: unhandled error during sign-in flow",
exc_info=True,
)
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail="OAuth authentication failed",
)
@router.get("/google/authorize-url") @router.get("/google/authorize-url")
async def get_google_authorize_url(redirect_uri: str): async def get_google_authorize_url(redirect_uri: str):
+5 -1
View File
@@ -142,7 +142,11 @@ class OAuthService:
except HTTPException: except HTTPException:
raise raise
except Exception as e: except Exception as e:
logger.error("OAuth [Google sign-in]: unexpected error: %s", e) logger.error(
"OAuth [Google sign-in]: unexpected error: %s",
e,
exc_info=True,
)
raise HTTPException( raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail="OAuth authentication failed", detail="OAuth authentication failed",