mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 11:16:00 +02:00
parent
0f352cab24
commit
d520b5b157
50 changed files with 2462 additions and 323 deletions
|
@ -11,6 +11,12 @@ module EppErrors
|
|||
epp_errors << collect_child_errors(attr)
|
||||
end
|
||||
|
||||
if self.class.reflect_on_aggregation(attr)
|
||||
aggregation = send(attr)
|
||||
epp_errors << collect_aggregation_errors(aggregation)
|
||||
next
|
||||
end
|
||||
|
||||
epp_errors << collect_parent_errors(attr, errors)
|
||||
end
|
||||
|
||||
|
@ -46,6 +52,31 @@ module EppErrors
|
|||
epp_errors
|
||||
end
|
||||
|
||||
def collect_aggregation_errors(aggregation)
|
||||
epp_errors = []
|
||||
|
||||
aggregation.errors.details.each do |attr, error_details|
|
||||
error_details.each do |error_detail|
|
||||
aggregation.class.epp_code_map.each do |epp_code, attr_to_error|
|
||||
epp_code_found = attr_to_error.any? { |i| i == [attr, error_detail[:error]] }
|
||||
|
||||
next unless epp_code_found
|
||||
|
||||
message = aggregation.errors.generate_message(attr, error_detail[:error], error_detail)
|
||||
message = aggregation.errors.full_message(attr, message)
|
||||
|
||||
if attr != :base
|
||||
message = "#{aggregation.model_name.human} #{message.camelize(:lower)}"
|
||||
end
|
||||
|
||||
epp_errors << { code: epp_code, msg: message }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
epp_errors
|
||||
end
|
||||
|
||||
def find_epp_code_and_value(msg)
|
||||
epp_code_map.each do |code, values|
|
||||
values.each do |x|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue