Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Merged
merged 2 commits into from

2 participants

@fzero

Wrapped file operations in a begin/rescue block.

Fabio Neves Making sure errors don't halt the import.
Wrapped file operations in a begin/rescue block.
20ac62d
@mattr- mattr- referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@parkr parkr merged commit 3bca5c3 into jekyll:master
@parkr
Owner

Thanks for the patch! I'll add in output of the error itself. ;-)

@parkr parkr referenced this pull request from a commit
@parkr parkr Reflected merging of #671 in History. 85c3bf6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 12, 2012
  1. Making sure errors don't halt the import.

    Fabio Neves authored
    Wrapped file operations in a begin/rescue block.
Commits on Dec 26, 2012
  1. @fzero
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 5 deletions.
  1. +12 −5 lib/jekyll/migrators/wordpressdotcom.rb
View
17 lib/jekyll/migrators/wordpressdotcom.rb
@@ -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
Something went wrong with that request. Please try again.