fix(analysis): log exceptions on analysis failure — was silently swallowed
This commit is contained in:
@@ -737,6 +737,7 @@ def _run_analysis(app, gid: str, inp: dict, persona_channel: str, llm) -> None:
|
||||
channel=inp.get("channel", "social"),
|
||||
)
|
||||
except Exception:
|
||||
app.logger.exception("analysis failed for group %s (sales kit)", gid)
|
||||
s["groups"].update(gid, status="failed", error="analysis_failed")
|
||||
return
|
||||
try:
|
||||
@@ -752,6 +753,7 @@ def _run_analysis(app, gid: str, inp: dict, persona_channel: str, llm) -> None:
|
||||
raise ValueError("persona generation returned malformed personas")
|
||||
personas = [persona for persona in personas if persona is not None]
|
||||
except Exception:
|
||||
app.logger.exception("analysis failed for group %s (persona generation)", gid)
|
||||
s["groups"].update(gid, status="failed", error="analysis_failed")
|
||||
return
|
||||
|
||||
@@ -765,6 +767,7 @@ def _run_analysis(app, gid: str, inp: dict, persona_channel: str, llm) -> None:
|
||||
try:
|
||||
report = build_report(sales_kit=sales_kit, personas=personas, language=inp.get("language", "th"))
|
||||
except Exception:
|
||||
app.logger.exception("analysis failed for group %s (report)", gid)
|
||||
s["groups"].update(gid, status="failed", error="analysis_failed")
|
||||
return
|
||||
# Publish the completed analysis as one atomic record replacement. Readers
|
||||
@@ -778,6 +781,7 @@ def _run_analysis(app, gid: str, inp: dict, persona_channel: str, llm) -> None:
|
||||
report=report,
|
||||
)
|
||||
except (TypeError, ValueError):
|
||||
app.logger.exception("analysis failed for group %s (publish)", gid)
|
||||
s["groups"].update(gid, status="failed", error="analysis_failed")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user