mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 12:08:27 +02:00
Story #105846070 - Arireg change error handling, raise business logic error Soap::Arireg:NotAvailableError
This commit is contained in:
parent
4c4908e5a6
commit
49dd053453
1 changed files with 12 additions and 3 deletions
|
@ -42,7 +42,16 @@ Implements Soap::Arireg # associated_businesses
|
||||||
# ssl_ca_cert
|
# ssl_ca_cert
|
||||||
|
|
||||||
module Soap
|
module Soap
|
||||||
|
|
||||||
class Arireg
|
class Arireg
|
||||||
|
|
||||||
|
class NotAvailableError < StandardError
|
||||||
|
def initialize(params)
|
||||||
|
params[:message] = "#{I18n.t(:business_registry_service_not_available)}" unless params.key? :message
|
||||||
|
super(params)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
attr_accessor :wsdl, :host, :username, :password
|
attr_accessor :wsdl, :host, :username, :password
|
||||||
end
|
end
|
||||||
|
@ -100,13 +109,13 @@ module Soap
|
||||||
end
|
end
|
||||||
rescue Savon::SOAPFault => fault
|
rescue Savon::SOAPFault => fault
|
||||||
Rails.logger.error "#{fault} Äriregister arireg #{self.class.username} at #{self.class.host }"
|
Rails.logger.error "#{fault} Äriregister arireg #{self.class.username} at #{self.class.host }"
|
||||||
nil
|
raise NotAvailableError.new(exception: fault)
|
||||||
rescue HTTPI::SSLError => ssl_error
|
rescue HTTPI::SSLError => ssl_error
|
||||||
Rails.logger.error "#{ssl_error} at #{self.class.host}"
|
Rails.logger.error "#{ssl_error} at #{self.class.host}"
|
||||||
nil
|
raise NotAvailableError.new(exception: ssl_error)
|
||||||
rescue SocketError => sock
|
rescue SocketError => sock
|
||||||
Rails.logger.error "#{sock}"
|
Rails.logger.error "#{sock}"
|
||||||
nil
|
raise NotAvailableError.new(exception: sock)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue