Bug Report
File: app.py — get_ai_insight() function
Problem
All exceptions in the Gemini API call are silently caught and return an empty string. This makes it impossible to debug issues like:
- Invalid API key
- Rate limiting (429 errors)
- Network timeouts
- Model deprecation
Current Code
except Exception:
return "" # Silent failure - user sees nothing, dev sees nothing
Expected Fix
except google.api_core.exceptions.ResourceExhausted:
st.warning("⚠️ Gemini API rate limit reached. Try again in a moment.")
return ""
except google.api_core.exceptions.InvalidArgument as e:
st.error(f"Invalid Gemini API key or request: {e}")
return ""
except Exception as e:
logger.error(f"Gemini insight failed: {type(e).__name__}: {e}")
st.caption(f"⚠️ AI insight unavailable: {type(e).__name__}")
return ""
Impact
- Users get no feedback when AI insight fails
- Developers cannot debug production errors
Severity
🔴 Critical — production debugging is impossible
bug gemini error-handling
Bug Report
File:
app.py—get_ai_insight()functionProblem
All exceptions in the Gemini API call are silently caught and return an empty string. This makes it impossible to debug issues like:
Current Code
Expected Fix
Impact
Severity
🔴 Critical — production debugging is impossible
buggeminierror-handling