Refactor epp errors to concern

This commit is contained in:
Martin Lensment 2014-08-07 14:19:36 +03:00
parent b944516f17
commit 6b86af3048
4 changed files with 15 additions and 65 deletions

View file

@ -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