Commit c20672b4 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Extract fail_unimplemented_klass!

parent eb5cd3f2
......@@ -24,6 +24,14 @@ module Geo
private
def fail_unimplemented_klass!(type:)
error_message = "Cannot find a handler for Gitlab::Geo #{type} for object_type = '#{object_type}'"
log_error(error_message)
raise NotImplementedError, error_message
end
def user_upload?
Gitlab::Geo::Replication.object_type_from_user_uploads?(object_type)
end
......
......@@ -37,10 +37,7 @@ module Geo
return Gitlab::Geo::Replication::JobArtifactDownloader if job_artifact?
return Gitlab::Geo::Replication::LfsDownloader if lfs?
error_message = "Cannot find a Gitlab::Geo Downloader for object_type = '#{object_type}'"
log_error(error_message)
raise NotImplementedError, error_message
fail_unimplemented_klass!(type: 'Downloader')
end
def log_file_download(mark_as_synced, download_result, start_time)
......
......@@ -41,10 +41,7 @@ module Geo
return Gitlab::Geo::Replication::JobArtifactRetriever if job_artifact?
return Gitlab::Geo::Replication::LfsRetriever if lfs?
error_message = "Cannot find a Gitlab::Geo Uploader for object_type = '#{object_type}'"
log_error(error_message)
raise NotImplementedError, error_message
fail_unimplemented_klass!(type: 'Retriever')
end
end
end
......@@ -5,6 +5,7 @@ module Gitlab
module Replication
class BaseRetriever
include LogHelpers
include Gitlab::Utils::StrongMemoize
attr_reader :object_db_id, :message
......
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