Log the error message when something went wrong creating a Geo event

parent c7ef65ba
...@@ -32,8 +32,8 @@ module Geo ...@@ -32,8 +32,8 @@ module Geo
return unless Gitlab::Geo.primary? return unless Gitlab::Geo.primary?
Geo::EventLog.create!("#{self.class.event_type}" => build_event) Geo::EventLog.create!("#{self.class.event_type}" => build_event)
rescue ActiveRecord::RecordInvalid, NoMethodError rescue ActiveRecord::RecordInvalid, NoMethodError => e
log("#{self.event_type.to_s.humanize} could not be created") log("#{self.event_type.to_s.humanize} could not be created", e)
end end
private private
...@@ -43,8 +43,8 @@ module Geo ...@@ -43,8 +43,8 @@ module Geo
"#{self.class} does not implement #{__method__}" "#{self.class} does not implement #{__method__}"
end end
def log(message) def log(message, error)
Rails.logger.error("#{self.class.name}: #{message} for project #{project.path_with_namespace} (#{project.id})") Rails.logger.error("#{self.class.name}: #{message} for project #{project.path_with_namespace} (#{project.id}): #{error}")
end end
end end
end end
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