mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 01:33:36 +02:00
Refactor epp errors to concern
This commit is contained in:
parent
b944516f17
commit
6b86af3048
4 changed files with 15 additions and 65 deletions
|
@ -6,10 +6,7 @@ module Epp::DomainsHelper
|
|||
if @domain.save && @domain.attach_contacts(domain_contacts) && @domain.attach_nameservers(domain_nameservers)
|
||||
render '/epp/domains/create'
|
||||
else
|
||||
@domain.construct_epp_errors
|
||||
|
||||
handle_errors
|
||||
render '/epp/error'
|
||||
handle_errors(@domain)
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
end
|
||||
|
@ -76,13 +73,4 @@ module Epp::DomainsHelper
|
|||
return ph[:hostAttr] if ph[:hostAttr]
|
||||
[]
|
||||
end
|
||||
|
||||
def handle_errors
|
||||
handle_epp_errors({
|
||||
'2302' => ['Domain name already exists', 'Domain name is reserved or restricted'],
|
||||
'2306' => ['Registrant is missing', 'Nameservers count must be between 1-13', 'Admin contact is missing'],
|
||||
'2303' => ['Contact was not found'],
|
||||
'2005' => ['Hostname is invalid', 'IP is invalid']
|
||||
}, @domain)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue