Skip to content

Commit

Permalink
Do not trap all exceptions without showing the error
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mscherer committed Mar 23, 2020
1 parent 3478afa commit 7dc230f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/planet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}'"
Expand Down

0 comments on commit 7dc230f

Please sign in to comment.