Propagate LLM errors in podcast handlers to frontend

- analysis.py: enhance_podcast_idea now re-raises HTTPException (429)
- analysis.py: analyze_podcast_idea already re-raises HTTPException
- research.py: re-raise HTTPException instead of silent fallback
- script.py: re-raise HTTPException instead of generic 500

Ensures 429 errors with usage_info reach frontend for modal display
This commit is contained in:
ajaysi
2026-03-31 19:32:23 +05:30
parent 49e0ee8e9e
commit 35fd700b22
3 changed files with 9 additions and 16 deletions

View File

@@ -160,10 +160,11 @@ Requirements:
summary = data.get("summary", "")
key_insights = [PodcastResearchInsight(**insight) for insight in data.get("key_insights", [])]
except HTTPException:
raise
except Exception as exc:
logger.error(f"[Podcast Research] LLM Insight extraction failed: {exc}")
# Fallback to a basic summary if LLM fails
summary = f"Research completed for '{request.topic}'. Found {len(sources)} sources."
raise HTTPException(status_code=500, detail=f"Research insight extraction failed: {exc}")
# Fallback: if summary is still empty (e.g. LLM returned empty string), use raw content first paragraph or basic text
if not summary: