Commit 2cb432c3 authored by Rajendra Kadam's avatar Rajendra Kadam

Add descriptive error message

parent 21b6f315
......@@ -29,7 +29,15 @@ module Gitlab
def validate!
unless skip_validation?
self.class.schemer.validate(attributes.stringify_keys).each do |error|
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(Metric::InvalidMetricError.new("#{error["details"] || error['data_pointer'] || error['data']} for `#{path}`"))
error_message = <<~ERROR_MSG
Error type: #{error['type'] || nil}
Data: #{error['data'] || nil}
Path: #{error['data_pointer'] || nil}
Details: #{error['details'] || nil}
Metric file: #{path}
ERROR_MSG
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(Metric::InvalidMetricError.new(error_message))
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