Skip to content
Snippets Groups Projects
Commit b58a2e30 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre
Browse files

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

parent c0403234
No related branches found
No related tags found
No related merge requests found
Loading
@@ -16,6 +16,8 @@ module Gitlab
Loading
@@ -16,6 +16,8 @@ module Gitlab
import_issues if has_issues? import_issues if has_issues?
   
true true
rescue ActiveRecord::RecordInvalid => e
raise Projects::ImportService::Error.new, e.message
ensure ensure
Gitlab::BitbucketImport::KeyDeleter.new(project).execute Gitlab::BitbucketImport::KeyDeleter.new(project).execute
end end
Loading
Loading
Loading
@@ -35,8 +35,8 @@ module Gitlab
Loading
@@ -35,8 +35,8 @@ module Gitlab
end end
   
true true
rescue ActiveRecord::RecordInvalid rescue ActiveRecord::RecordInvalid => e
false raise Projects::ImportService::Error, e.message
end end
   
def import_pull_requests def import_pull_requests
Loading
@@ -53,8 +53,8 @@ module Gitlab
Loading
@@ -53,8 +53,8 @@ module Gitlab
end end
   
true true
rescue ActiveRecord::RecordInvalid rescue ActiveRecord::RecordInvalid => e
false raise Projects::ImportService::Error, e.message
end end
   
def import_comments(issue_number, noteable) def import_comments(issue_number, noteable)
Loading
@@ -83,10 +83,13 @@ module Gitlab
Loading
@@ -83,10 +83,13 @@ module Gitlab
   
true true
rescue Gitlab::Shell::Error => e rescue Gitlab::Shell::Error => e
if e.message =~ /repository not exported/ # GitHub error message when the wiki repo has not been created,
true # 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 else
false true
end end
end end
end end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment