mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 02:09:39 +02:00
Renewed logic for error handling
This commit is contained in:
parent
86dc8321c6
commit
8dfb80c1ea
5 changed files with 13 additions and 5 deletions
|
@ -35,6 +35,11 @@ module Epp::Common
|
|||
def handle_errors(error_code_map, obj)
|
||||
obj.errors.each do |key, err|
|
||||
error_code_map.each do |code, values|
|
||||
|
||||
has_error = Proc.new do |x|
|
||||
x.is_a?(Array) ? obj.errors.added?(key, x[0], x[1]) : obj.errors.added?(key, x)
|
||||
end
|
||||
|
||||
if err.is_a?(Hash)
|
||||
epp_errors << {
|
||||
code: code,
|
||||
|
@ -45,7 +50,7 @@ module Epp::Common
|
|||
epp_errors << {
|
||||
code: code,
|
||||
msg: err,
|
||||
} and break if values.any? {|x| obj.errors.added?(key, x) }
|
||||
} and break if values.any? {|x| has_error.call(x)}
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue