mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 16:53:37 +02:00
Story #105846070 - show error message to user when service not available
This commit is contained in:
parent
c926aa4100
commit
352c748258
3 changed files with 8 additions and 3 deletions
|
@ -2,6 +2,11 @@ class Registrant::DomainsController < RegistrantController
|
|||
def index
|
||||
authorize! :view, :registrant_domains
|
||||
ident_cc, ident = @current_user.registrant_ident.split '-'
|
||||
@domains = BusinessRegistryCache.fetch_associated_domains ident, ident_cc
|
||||
begin
|
||||
@domains = BusinessRegistryCache.fetch_associated_domains ident, ident_cc
|
||||
rescue Soap::Arireg::NotAvailableError => error
|
||||
flash[:notice] = I18n.t(error.message[:message])
|
||||
@domains = []
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -48,7 +48,7 @@ class BusinessRegistryCache < ActiveRecord::Base
|
|||
cache = BusinessRegistryCache.find_by(ident: ident_code, ident_country_code: ident_cc)
|
||||
# fetch new data if cache is expired
|
||||
return cache if cache.present? && cache.retrieved_on > (Time.zone.now - Setting.days_to_keep_business_registry_cache.days)
|
||||
cache = nil # expired data is forbidden
|
||||
cache = [] # expired data is forbidden
|
||||
data = business_registry.associated_businesses(ident_code, ident_cc)
|
||||
unless data.nil?
|
||||
cache = BusinessRegistryCache.new(data)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
%th{class: 'col-xs-2'}
|
||||
= t(:registrar)
|
||||
%tbody
|
||||
- @domains.each do |x|
|
||||
- @domains.try(:each) do |x|
|
||||
%tr
|
||||
%td= x
|
||||
%td= x.registrant
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue