instance method
translate_exception
Ruby on Rails 3.1.12
Since v3.1.12Signature
translate_exception(exception, message)
No documentation comment.
Parameters
-
exceptionreq -
messagereq
Source
# File activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb, line 650
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
Defined in activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb line 650
· View on GitHub
· Improve this page
· Find usages on GitHub