Rescue from import errors on Wordpress.com plugin. #671

Merged
merged 2 commits into from Jan 18, 2013
Jump to file or symbol
Failed to load files and symbols.
+12 −5
Diff settings

Always

Just for now

@@ -52,11 +52,18 @@ def self.process(filename = "wordpress.xml")
'meta' => metas
}
- FileUtils.mkdir_p "_#{type}s"
- File.open("_#{type}s/#{name}", "w") do |f|
- f.puts header.to_yaml
- f.puts '---'
- f.puts item.at('content:encoded').inner_text
+ begin
+ FileUtils.mkdir_p "_#{type}s"
+ File.open("_#{type}s/#{name}", "w") do |f|
+ f.puts header.to_yaml
+ f.puts '---'
+ f.puts item.at('content:encoded').inner_text
+ end
+ rescue
+ puts "Couldn't import post!"
+ puts "Title: #{title}"
+ puts "Name/Slug: #{name}\n"
+ next
end
import_count[type] += 1