mirror of
https://github.com/internetee/registry.git
synced 2025-06-02 18:58:35 +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
|
||||
obj.construct_epp_errors
|
||||
@errors += obj.errors[:epp_errors]
|
||||
@errors += obj.errors.where[:epp_errors].flatten
|
||||
end
|
||||
|
||||
if params[:parsed_frame]&.at_css('update')
|
||||
|
|
|
@ -6,8 +6,8 @@ module EppErrors
|
|||
|
||||
def construct_epp_errors
|
||||
epp_errors = []
|
||||
errors.messages.each do |attr, errors|
|
||||
attr = attr.to_s.split('.')[0].to_sym
|
||||
errors.each do |error|
|
||||
attr = error.attribute.to_s.split('.')[0].to_sym
|
||||
next if attr == :epp_errors
|
||||
|
||||
if self.class.reflect_on_association(attr)
|
||||
|
@ -20,9 +20,9 @@ module EppErrors
|
|||
next
|
||||
end
|
||||
|
||||
epp_errors << collect_parent_errors(attr, errors)
|
||||
epp_errors << collect_parent_errors(attr, error.message)
|
||||
end
|
||||
errors.add(:epp_errors, epp_errors) unless epp_errors.empty?
|
||||
errors.add(:epp_errors, epp_errors.flatten) unless epp_errors.empty?
|
||||
end
|
||||
|
||||
def collect_parent_errors(attr, errors)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue