mirror of
https://github.com/internetee/registry.git
synced 2025-05-20 11:19:39 +02:00
Value returning with error message
This commit is contained in:
parent
3fc3bfc1c4
commit
e4ac417bde
5 changed files with 28 additions and 3 deletions
|
@ -35,7 +35,19 @@ module Epp::Common
|
|||
def handle_errors(error_code_map, obj)
|
||||
obj.errors.each do |key, err|
|
||||
error_code_map.each do |code, values|
|
||||
epp_errors << {code: code, msg: err} and break if values.any? {|x| obj.errors.added?(key, x) }
|
||||
if err.is_a?(Hash)
|
||||
epp_errors << {
|
||||
code: code,
|
||||
msg: err[:msg],
|
||||
value: {obj: err[:obj], val: err[:val]},
|
||||
} and break if values.any? {|x| I18n.t("errors.messages.#{x}") == err[:msg] }
|
||||
else
|
||||
epp_errors << {
|
||||
code: code,
|
||||
msg: err,
|
||||
} and break if values.any? {|x| obj.errors.added?(key, x) }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue