mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 16:32:04 +02:00
Refactor error handling to common
This commit is contained in:
parent
fb8cba9ef4
commit
3fc3bfc1c4
2 changed files with 12 additions and 8 deletions
|
@ -32,6 +32,14 @@ module Epp::Common
|
|||
@current_epp_user ||= EppUser.find(epp_session[:epp_user_id]) if epp_session[:epp_user_id]
|
||||
end
|
||||
|
||||
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) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def validate_request
|
||||
type = OBJECT_TYPES[params_hash['epp']['xmlns:ns2']]
|
||||
return unless type
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue