Module: ActiveRecord::ConnectionAdapters::Sqlserver::Errors

Included in:
ActiveRecord::ConnectionAdapters::SQLServerAdapter
Defined in:
lib/active_record/connection_adapters/sqlserver/errors.rb

Constant Summary collapse

LOST_CONNECTION_EXCEPTIONS =
{
  dblib: ['TinyTds::Error'],
  odbc: ['ODBC::Error']
}.freeze
LOST_CONNECTION_MESSAGES =
{
  dblib: [/closed connection/, /dead or not enabled/, /server failed/i],
  odbc: [/link failure/, /server failed/, /connection was already closed/, /invalid handle/i]
}.freeze

Instance Method Summary collapse

Instance Method Details

#lost_connection_exceptionsObject



21
22
23
24
# File 'lib/active_record/connection_adapters/sqlserver/errors.rb', line 21

def lost_connection_exceptions
  exceptions = LOST_CONNECTION_EXCEPTIONS[@connection_options[:mode]]
  @lost_connection_exceptions ||= exceptions ? exceptions.map { |e| e.constantize rescue nil }.compact : []
end

#lost_connection_messagesObject



26
27
28
# File 'lib/active_record/connection_adapters/sqlserver/errors.rb', line 26

def lost_connection_messages
  LOST_CONNECTION_MESSAGES[@connection_options[:mode]]
end