mirror of
https://github.com/jekyll/jekyll.git
synced 2026-01-31 09:48:30 -05:00
Making sure errors don't halt the import.
Wrapped file operations in a begin/rescue block.
This commit is contained in:
@@ -52,11 +52,18 @@ module Jekyll
|
||||
'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
|
||||
|
||||
Reference in New Issue
Block a user