mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 16:02:03 +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
|
@ -20,6 +20,7 @@ module Epp::DomainsHelper
|
|||
end
|
||||
|
||||
### HELPER METHODS ###
|
||||
private
|
||||
|
||||
def domain_create_params
|
||||
ph = params_hash['epp']['command']['create']['create']
|
||||
|
@ -50,17 +51,12 @@ module Epp::DomainsHelper
|
|||
end
|
||||
|
||||
def handle_errors
|
||||
error_code_map = {
|
||||
super({
|
||||
'2302' => [:epp_domain_taken, :epp_domain_reserved],
|
||||
'2306' => [:blank],
|
||||
'2303' => [:epp_contact_not_found]
|
||||
}
|
||||
|
||||
@domain.errors.each do |key, err|
|
||||
error_code_map.each do |code, values|
|
||||
epp_errors << {code: code, msg: err} and break if values.any? {|x| @domain.errors.added?(key, x) }
|
||||
end
|
||||
end
|
||||
}, @domain
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue