Skip to content

feat: sanitize raw Gemini API error traces (issue #139)#173

Open
Talhaasif7 wants to merge 3 commits into
daviddprtma:mainfrom
Talhaasif7:feat/gemini-error-sanitization
Open

feat: sanitize raw Gemini API error traces (issue #139)#173
Talhaasif7 wants to merge 3 commits into
daviddprtma:mainfrom
Talhaasif7:feat/gemini-error-sanitization

Conversation

@Talhaasif7

Copy link
Copy Markdown
Contributor

📌 Related Issue

Fixes #139


Description of Changes

Sanitized low-level exceptions and credential errors from the Gemini API to prevent raw logs and keys (like API_KEY_INVALID) from leaking to the frontend UI.

  • Backend Sanitization: Added a sanitizeError helper function in backend/src/ai/gemini.js that intercepts low-level SDK traces, API key configuration errors, and timeout errors, mapping them to clean, user-friendly statements.
  • Frontend Guarding: Added a defensive getCleanInsightError mapper in src/pages/Dashboard.tsx to double-guard raw strings before displaying them in the AI Note card.

Type of Change

  • 🐛 Bug Fix
  • ✨ New Feature
  • 🎨 UI/UX or Design Update
  • Other

✅ Checklist

  • I’ve read the CONTRIBUTING.md guidelines.
  • My code follows the project’s conventions.
  • I’ve linked the related issue correctly.
  • I’ve tested my changes locally.
  • I’ve added or updated documentation/comments if needed.
  • My PR title follows the branch & commit naming conventions.
  • My changes introduce no new warnings or errors.
  • I’ve performed a self-review of my work.

💬 Additional Notes (Optional)

Unit tests ran and passed successfully. Production build (npm run build) and linting (npm run lint) check out with 0 errors.

@vercel

vercel Bot commented Jun 23, 2026

Copy link
Copy Markdown

@Talhaasif7 is attempting to deploy a commit to the daviddprtma's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

🐛: Bug: Raw Gemini API error trace (API_KEY_INVALID) is exposed in the UI

1 participant