From 7dc230f75ed6867169ab69fd5e9b50d0c8920ab1 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Mon, 23 Mar 2020 22:47:10 +0100 Subject: [PATCH] Do not trap all exceptions without showing the error Also fix the call to Feedjira, since the parse method is not in the module and not in a submodule. The error was hidden due to exception catching --- lib/planet.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/planet.rb b/lib/planet.rb index f1a20ea..92a8f75 100644 --- a/lib/planet.rb +++ b/lib/planet.rb @@ -65,8 +65,9 @@ def download_feed(feed_url, time_ago = nil) # Parse the feed, with a fallback message as to why it might not work def parse_feed(feed_raw, feed_url = 'unknown feed') - Feedjira::Feed.parse(feed_raw) unless feed_raw.to_s == '' -rescue + Feedjira.parse(feed_raw) unless feed_raw.to_s == '' +rescue StandardError => e + puts "ERR: #{e.message}" head = http_head(feed_url) err_msg = if defined?(head.content_type) then "Server sent '#{head.content_type}'" else "No data sent" end puts "ERR: #{err_msg}; problem parsing '#{feed_url}'"