Finish the import process if some error occurs when fetching the repo

parent 1f498b73
module Github
class Error < StandardError
end
class RepositoryFetchError < Error; end
end
require_relative 'error'
module Github module Github
class Import class Import
include Gitlab::ShellAdapter include Gitlab::ShellAdapter
...@@ -48,9 +49,12 @@ module Github ...@@ -48,9 +49,12 @@ module Github
fetch_issues fetch_issues
fetch_wiki_repository fetch_wiki_repository
expire_repository_cache expire_repository_cache
track_errors
errors true
rescue Github::RepositoryFetchError
false
ensure
keep_track_of_errors
end end
private private
...@@ -63,6 +67,7 @@ module Github ...@@ -63,6 +67,7 @@ module Github
project.repository.fetch_remote('github', forced: true) project.repository.fetch_remote('github', forced: true)
rescue Gitlab::Shell::Error => e rescue Gitlab::Shell::Error => e
error(:project, "https://github.com/#{repo}.git", e.message) error(:project, "https://github.com/#{repo}.git", e.message)
raise Github::RepositoryFetchError
end end
end end
...@@ -368,7 +373,7 @@ module Github ...@@ -368,7 +373,7 @@ module Github
repository.expire_content_cache repository.expire_content_cache
end end
def track_errors def keep_track_of_errors
return unless errors.any? return unless errors.any?
project.update_column(:import_error, { project.update_column(:import_error, {
......
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