method

translate_exception

Importance_0
v7.1.3.4 - Show latest stable - 0 notes - Class: Mysql2Adapter
translate_exception(exception, message:, sql:, binds:) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 184
        def translate_exception(exception, message,, sql,, binds))
          if exception.is_a?(::Mysql2::Error::TimeoutError) && !exception.error_number
            ActiveRecord::AdapterTimeout.new(message, sql: sql, binds: binds, connection_pool: @pool)
          elsif exception.is_a?(::Mysql2::Error::ConnectionError)
            if exception.message.match?(/MySQL client is not connected/)
              ActiveRecord::ConnectionNotEstablished.new(exception, connection_pool: @pool)
            else
              ActiveRecord::ConnectionFailed.new(message, sql: sql, binds: binds, connection_pool: @pool)
            end
          else
            super
          end
        end
Register or log in to add new notes.