summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-01-22 13:00:00 -0200
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-01-26 10:56:22 -0200
commitb58a2e30b214ffc98f492aab88137cc3fd48355d (patch)
tree7a6141d9cd107d1ec751adbe1089af5927f694d1
parentc0403234193dcb2033bd57160bb0ab6893bb8d77 (diff)
downloadgitlab-ce-b58a2e30b214ffc98f492aab88137cc3fd48355d.tar.gz
Wrap errors on GitHub importer to raise Projects::ImportService::Error
-rw-r--r--lib/gitlab/bitbucket_import/importer.rb2
-rw-r--r--lib/gitlab/github_import/importer.rb17
2 files changed, 12 insertions, 7 deletions
diff --git a/lib/gitlab/bitbucket_import/importer.rb b/lib/gitlab/bitbucket_import/importer.rb
index e8c6d89764c..3f483847efa 100644
--- a/lib/gitlab/bitbucket_import/importer.rb
+++ b/lib/gitlab/bitbucket_import/importer.rb
@@ -16,6 +16,8 @@ module Gitlab
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
diff --git a/lib/gitlab/github_import/importer.rb b/lib/gitlab/github_import/importer.rb
index 663402e8197..e2a85f29825 100644
--- a/lib/gitlab/github_import/importer.rb
+++ b/lib/gitlab/github_import/importer.rb
@@ -35,8 +35,8 @@ module Gitlab
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 @@ module Gitlab
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 @@ module Gitlab
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