1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge branch 'move_mysql2_out_of_abstract_adapter'

This commit is contained in:
eileencodes 2019-08-29 09:02:54 -04:00
commit 520111096f
2 changed files with 9 additions and 5 deletions

View file

@ -623,11 +623,7 @@ module ActiveRecord
when ER_QUERY_INTERRUPTED
QueryCanceled.new(message, sql: sql, binds: binds)
else
if exception.is_a?(Mysql2::Error::TimeoutError)
ActiveRecord::AdapterTimeout.new(message, sql: sql, binds: binds)
else
super
end
super
end
end

View file

@ -140,6 +140,14 @@ module ActiveRecord
def get_full_version
@connection.server_info[:version]
end
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)
else
super
end
end
end
end
end