Skip to content

Commit

Permalink
debug summary fails
Browse files Browse the repository at this point in the history
  • Loading branch information
djdefi committed Dec 18, 2024
1 parent caf304d commit 3bbf5e8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 25 deletions.
8 changes: 7 additions & 1 deletion render.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,14 @@ def summarize_news(feeds)
summary = "No summary available."
end
summary
rescue HTTParty::Error => e
puts "HTTP error summarizing news: #{e.message}"
nil
rescue JSON::ParserError => e
puts "JSON parsing error summarizing news: #{e.message}"
nil
rescue => e
puts "Error summarizing news: #{e.message}"
puts "General error summarizing news: #{e.message}"
nil
end
end
Expand Down
49 changes: 25 additions & 24 deletions templates/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,36 @@
</head>
<body>
<div>
<div style="padding:10px;">
<strong style="color:#c00;"><%= title %></strong>
|
<span><%= Time.now.strftime('%F %R %Z') -%></span>
</div><hr/>
<div style="padding:10px;">
<strong style="color:#c00;"><%= title %></strong>
|
<span><%= Time.now.strftime('%F %R %Z') -%></span>
</div>
<hr/>
<% if news_summary && !news_summary.empty? %>
<div class="news-summary">
<strong>News Summary</strong>
<p><%= news_summary %></p>
</div>
<hr/>
<div class="firehose">
<strong>Stories</strong>
<p>
<% rss_urls.each do |url| -%>

<h3>
<a href='<%= url.gsub '/feed/', '' %>'><%= url.gsub '/feed/', '' %> - <%= feed(url).items.count %> items:</a>
</h3>
<ul>
<% feed(url).items.each do |item| -%>
<li>
<a href='<%= item.link %>' > <%= item.title %></a>
</li>
<% end -%>
</ul>

<% end -%>
</p>
</div>
<% end %>
<div class="firehose">
<strong>Stories</strong>
<p>
<% rss_urls.each do |url| -%>
<h3>
<a href='<%= url.gsub '/feed/', '' %>'><%= url.gsub '/feed/', '' %> - <%= feed(url).items.count %> items:</a>
</h3>
<ul>
<% feed(url).items.each do |item| -%>
<li>
<a href='<%= item.link %>'><%= item.title %></a>
</li>
<% end -%>
</ul>
<% end -%>
</p>
</div>
</div>

<% if analytics_ua %>
Expand Down

0 comments on commit 3bbf5e8

Please sign in to comment.