mirror of
https://github.com/internetee/registry.git
synced 2025-06-04 11:47:30 +02:00
First iteration of epp error refactoring
This commit is contained in:
parent
7be87de865
commit
72c865e656
2 changed files with 5 additions and 5 deletions
|
@ -102,7 +102,7 @@ module Epp
|
||||||
|
|
||||||
if obj
|
if obj
|
||||||
obj.construct_epp_errors
|
obj.construct_epp_errors
|
||||||
@errors += obj.errors[:epp_errors]
|
@errors += obj.errors.where[:epp_errors].flatten
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:parsed_frame]&.at_css('update')
|
if params[:parsed_frame]&.at_css('update')
|
||||||
|
|
|
@ -6,8 +6,8 @@ module EppErrors
|
||||||
|
|
||||||
def construct_epp_errors
|
def construct_epp_errors
|
||||||
epp_errors = []
|
epp_errors = []
|
||||||
errors.messages.each do |attr, errors|
|
errors.each do |error|
|
||||||
attr = attr.to_s.split('.')[0].to_sym
|
attr = error.attribute.to_s.split('.')[0].to_sym
|
||||||
next if attr == :epp_errors
|
next if attr == :epp_errors
|
||||||
|
|
||||||
if self.class.reflect_on_association(attr)
|
if self.class.reflect_on_association(attr)
|
||||||
|
@ -20,9 +20,9 @@ module EppErrors
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
epp_errors << collect_parent_errors(attr, errors)
|
epp_errors << collect_parent_errors(attr, error.message)
|
||||||
end
|
end
|
||||||
errors.add(:epp_errors, epp_errors) unless epp_errors.empty?
|
errors.add(:epp_errors, epp_errors.flatten) unless epp_errors.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def collect_parent_errors(attr, errors)
|
def collect_parent_errors(attr, errors)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue