Skip to content

Commit

Permalink
rescue and display exceptions during feed generation
Browse files Browse the repository at this point in the history
  • Loading branch information
konto-andrzeja committed Jul 2, 2016
1 parent 733609c commit 8081bdf
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions app/services/generate_rss.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@ def initialize(page)
end

def call
@browser.visit(@page.url)
result = {
title: fetch_title,
description: fetch_description,
url: @page.url,
articles: fetch_articles
}
@page.errors.empty? ? result : nil
begin
@browser.visit(@page.url)
result = {
title: fetch_title,
description: fetch_description,
url: @page.url,
articles: fetch_articles
}
@page.errors.empty? ? result : nil
rescue Exception => e
@page.errors[:exception] << ": #{e.message}"
nil
end
end

private
Expand Down

0 comments on commit 8081bdf

Please sign in to comment.