diff options
-rw-r--r-- | lib/github/error.rb | 6 | ||||
-rw-r--r-- | lib/github/import.rb | 11 |
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/github/error.rb b/lib/github/error.rb new file mode 100644 index 00000000000..41cd4c67847 --- /dev/null +++ b/lib/github/error.rb @@ -0,0 +1,6 @@ +module Github + class Error < StandardError + end + + class RepositoryFetchError < Error; end +end diff --git a/lib/github/import.rb b/lib/github/import.rb index 8ffbb21bac0..56b0b7a3d4f 100644 --- a/lib/github/import.rb +++ b/lib/github/import.rb @@ -1,3 +1,4 @@ +require_relative 'error' module Github class Import include Gitlab::ShellAdapter @@ -48,9 +49,12 @@ module Github fetch_issues fetch_wiki_repository expire_repository_cache - track_errors - errors + true + rescue Github::RepositoryFetchError + false + ensure + keep_track_of_errors end private @@ -63,6 +67,7 @@ module Github project.repository.fetch_remote('github', forced: true) rescue Gitlab::Shell::Error => e error(:project, "https://github.com/#{repo}.git", e.message) + raise Github::RepositoryFetchError end end @@ -368,7 +373,7 @@ module Github repository.expire_content_cache end - def track_errors + def keep_track_of_errors return unless errors.any? project.update_column(:import_error, { |