We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0808ba1 commit 0ae7055Copy full SHA for 0ae7055
1 file changed
backend/services/calendar_service.py
@@ -50,10 +50,13 @@ async def exchange_code(code: str) -> dict:
50
51
async def _get_valid_token(user_id: str) -> str:
52
supabase = get_supabase()
53
- row = supabase.table("user_profiles").select(
54
- "gcal_access_token, gcal_refresh_token, gcal_token_expires_at"
55
- ).eq("id", user_id).single().execute()
56
- data = row.data or {}
+ try:
+ row = supabase.table("user_profiles").select(
+ "gcal_access_token, gcal_refresh_token, gcal_token_expires_at"
+ ).eq("id", user_id).single().execute()
57
+ data = row.data or {}
58
+ except Exception:
59
+ raise ValueError("Google Calendar not connected")
60
61
access_token = data.get("gcal_access_token")
62
refresh_tok = data.get("gcal_refresh_token")
0 commit comments