Rescue errors when running dry run for UploadRecovery.

This commit is contained in:
Guo Xiang Tan 2018-09-13 11:57:51 +08:00
parent d257b4a386
commit 50f7e2be64

View File

@ -5,6 +5,7 @@ class UploadRecovery
def recover def recover
Post.where("raw LIKE '%upload:\/\/%'").find_each do |post| Post.where("raw LIKE '%upload:\/\/%'").find_each do |post|
begin
analyzer = PostAnalyzer.new(post.raw, post.topic_id) analyzer = PostAnalyzer.new(post.raw, post.topic_id)
cooked_stripped = analyzer.send(:cooked_stripped) cooked_stripped = analyzer.send(:cooked_stripped)
@ -23,6 +24,10 @@ class UploadRecovery
end end
end end
end end
rescue => e
raise e unless @dry_run
puts "#{post.full_url} #{e.class}: #{e.message}"
end
end end
end end