mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 01:36:02 +02:00
Make EPP errors more compact
This commit is contained in:
parent
0a2ed60b9e
commit
7b750b7d9b
4 changed files with 20 additions and 46 deletions
|
@ -4,6 +4,7 @@ module EppErrors
|
|||
def construct_epp_errors
|
||||
epp_errors = []
|
||||
errors.messages.each do |key, values|
|
||||
next if key == :epp_errors
|
||||
if self.class.reflect_on_association(key)
|
||||
epp_errors << collect_child_errors(key)
|
||||
end
|
||||
|
@ -71,4 +72,11 @@ module EppErrors
|
|||
end
|
||||
nil
|
||||
end
|
||||
|
||||
def add_epp_error(code, obj, val, msg)
|
||||
errors[:epp_errors] ||= []
|
||||
t = errors.generate_message(*msg) if msg.is_a?(Array)
|
||||
t = msg if msg.is_a?(String)
|
||||
errors[:epp_errors] << { code: code, msg: t, value: { val: val, obj: obj } }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue