method

translate_exception

Importance_0
v3.1.0 - Show latest stable - 0 notes - Class: Mysql2Adapter
translate_exception(exception, message) protected

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 636
        def translate_exception(exception, message)
          return super unless exception.respond_to?(:error_number)

          case exception.error_number
          when 1062
            RecordNotUnique.new(message, exception)
          when 1452
            InvalidForeignKey.new(message, exception)
          else
            super
          end
        end
Register or log in to add new notes.