mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 02:39:37 +02:00
Story#117124725 - show errors if something happens
This commit is contained in:
parent
28bed16539
commit
ce124beb8f
1 changed files with 14 additions and 1 deletions
|
@ -3,17 +3,30 @@ class DomainDeleteConfirmJob < Que::Job
|
||||||
# it's recommended to keep transaction against job table as short as possible.
|
# it's recommended to keep transaction against job table as short as possible.
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
domain = Epp::Domain.find(domain_id)
|
domain = Epp::Domain.find(domain_id)
|
||||||
|
|
||||||
case action
|
case action
|
||||||
when RegistrantVerification::CONFIRMED
|
when RegistrantVerification::CONFIRMED
|
||||||
domain.poll_message!(:poll_pending_delete_confirmed_by_registrant)
|
domain.poll_message!(:poll_pending_delete_confirmed_by_registrant)
|
||||||
domain.apply_pending_delete!
|
domain.apply_pending_delete!
|
||||||
|
raise_errors!(domain)
|
||||||
|
|
||||||
when RegistrantVerification::REJECTED
|
when RegistrantVerification::REJECTED
|
||||||
DomainMailer.pending_delete_rejected_notification(domain_id, true).deliver
|
|
||||||
domain.statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
domain.statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
||||||
domain.poll_message!(:poll_pending_delete_rejected_by_registrant)
|
domain.poll_message!(:poll_pending_delete_rejected_by_registrant)
|
||||||
|
|
||||||
domain.cancel_pending_delete
|
domain.cancel_pending_delete
|
||||||
|
domain.save(validate: false)
|
||||||
|
raise_errors!(domain)
|
||||||
|
|
||||||
|
DomainMailer.pending_delete_rejected_notification(domain_id, true).deliver
|
||||||
end
|
end
|
||||||
|
|
||||||
destroy # it's best to destroy the job in the same transaction
|
destroy # it's best to destroy the job in the same transaction
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def raise_errors!(domain)
|
||||||
|
throw "domain #{domain.name} failed with errors #{domain.errors.full_messages}" if domain.errors.any?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue