Fix output order and add Reddit error handling
- SKILL.md: Move "What I learned" BEFORE "Research Complete" stats - Add error tracking to Report schema (reddit_error, x_error fields) - Wrap OpenAI API calls in try/catch with clear error messages - Show explicit error or "no results" messages in compact output - Fix false positive error detection for null error fields Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+22
-2
@@ -46,7 +46,17 @@ def render_compact(report: schema.Report, limit: int = 15) -> str:
|
||||
lines.append("")
|
||||
|
||||
# Reddit items
|
||||
if report.reddit:
|
||||
if report.reddit_error:
|
||||
lines.append("### Reddit Threads")
|
||||
lines.append("")
|
||||
lines.append(f"**ERROR:** {report.reddit_error}")
|
||||
lines.append("")
|
||||
elif report.mode in ("both", "reddit-only") and not report.reddit:
|
||||
lines.append("### Reddit Threads")
|
||||
lines.append("")
|
||||
lines.append("*No relevant Reddit threads found for this topic.*")
|
||||
lines.append("")
|
||||
elif report.reddit:
|
||||
lines.append("### Reddit Threads")
|
||||
lines.append("")
|
||||
for item in report.reddit[:limit]:
|
||||
@@ -78,7 +88,17 @@ def render_compact(report: schema.Report, limit: int = 15) -> str:
|
||||
lines.append("")
|
||||
|
||||
# X items
|
||||
if report.x:
|
||||
if report.x_error:
|
||||
lines.append("### X Posts")
|
||||
lines.append("")
|
||||
lines.append(f"**ERROR:** {report.x_error}")
|
||||
lines.append("")
|
||||
elif report.mode in ("both", "x-only") and not report.x:
|
||||
lines.append("### X Posts")
|
||||
lines.append("")
|
||||
lines.append("*No relevant X posts found for this topic.*")
|
||||
lines.append("")
|
||||
elif report.x:
|
||||
lines.append("### X Posts")
|
||||
lines.append("")
|
||||
for item in report.x[:limit]:
|
||||
|
||||
Reference in New Issue
Block a user