Introduce new epp error api #2588

This commit is contained in:
Martin Lensment 2015-07-21 14:08:10 +03:00
parent 8ed8687691
commit ea5a2e54fb
2 changed files with 16 additions and 2 deletions

View file

@ -8,6 +8,18 @@ class EppController < ApplicationController
before_action :latin_only before_action :latin_only
before_action :validate_request before_action :validate_request
before_action :update_epp_session before_action :update_epp_session
around_action :catch_epp_errors
def catch_epp_errors
err = catch(:epp_error) do
yield
nil
end
return unless err
@errors = [err]
handle_errors
end
helper_method :current_user helper_method :current_user
rescue_from StandardError do |e| rescue_from StandardError do |e|

View file

@ -617,8 +617,10 @@ class Epp::Domain < Domain
def reject_transfer(frame, current_user) def reject_transfer(frame, current_user)
pt = pending_transfer pt = pending_transfer
if current_user.registrar != pt.transfer_from if current_user.registrar != pt.transfer_from
add_epp_error('2304', nil, nil, I18n.t('transfer_can_be_rejected_only_by_current_registrar')) throw :epp_error, {
return false msg: I18n.t('transfer_can_be_rejected_only_by_current_registrar'),
code: '2304'
}
end end
transaction do transaction do