Wrap errors on GitHub importer to raise Projects::ImportService::Error

parent c0403234
......@@ -16,6 +16,8 @@ def execute
import_issues if has_issues?
true
rescue ActiveRecord::RecordInvalid => e
raise Projects::ImportService::Error.new, e.message
ensure
Gitlab::BitbucketImport::KeyDeleter.new(project).execute
end
......
......@@ -35,8 +35,8 @@ def import_issues
end
true
rescue ActiveRecord::RecordInvalid
false
rescue ActiveRecord::RecordInvalid => e
raise Projects::ImportService::Error, e.message
end
def import_pull_requests
......@@ -53,8 +53,8 @@ def import_pull_requests
end
true
rescue ActiveRecord::RecordInvalid
false
rescue ActiveRecord::RecordInvalid => e
raise Projects::ImportService::Error, e.message
end
def import_comments(issue_number, noteable)
......@@ -83,10 +83,13 @@ def import_wiki
true
rescue Gitlab::Shell::Error => e
if e.message =~ /repository not exported/
true
# GitHub error message when the wiki repo has not been created,
# this means that repo has wiki enabled, but have no pages. So,
# we can skip the import.
if e.message !~ /repository not exported/
raise Projects::ImportService::Error, e.message
else
false
true
end
end
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment