Skip to content
Browse files

Home run...

  • Loading branch information...
1 parent 045f91a commit 6fd9daec191dc2f30fefc07d2ddd49a921c34d01 @christianhellsten committed Oct 30, 2012
Showing with 6 additions and 2 deletions.
  1. +1 −0 feedr.gemspec
  2. +5 −2 lib/feedr/active_record/feed.rb
View
1 feedr.gemspec
@@ -10,6 +10,7 @@ Gem::Specification.new do |gem|
gem.add_dependency "feedzirra"
gem.add_dependency "activerecord", '>=3.1'
+ gem.add_dependency 'home_run'
gem.add_development_dependency "pry"
gem.add_development_dependency "guard"
View
7 lib/feedr/active_record/feed.rb
@@ -50,15 +50,16 @@ def on_error(status_code)
self.last_fetched_at = Time.now
self.last_error_at = Time.now
self.error_count += 1
- self.error = status_code
+ self.error = status_code
end
def after_parse(feed)
+ on_error(-666) and return unless feed # Feed is nil sometimes
new_entries = []
self.last_fetched_at = Time.now
self.last_error_at = nil
self.error = nil
- self.error_count = nil
+ self.error_count = 0
self.title = feed.title
self.etag = feed.etag
self.last_modified_at = feed.last_modified
@@ -75,6 +76,8 @@ def after_parse(feed)
end
end
new_entries
+ rescue Exception => ex
+ Feedr.logger.error [ex.message, ex.backtrace.join("\n")].join("\n")
end
def fetch

0 comments on commit 6fd9dae

Please sign in to comment.
Something went wrong with that request. Please try again.