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



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

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



29
30
31
# File 'lib/active_record/connection_adapters/sqlserver/errors.rb', line 29

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