diff --git a/activerecord/lib/active_record/connection_adapters/trilogy_adapter.rb b/activerecord/lib/active_record/connection_adapters/trilogy_adapter.rb index d5d86efdf495e..46d782a3b3a67 100644 --- a/activerecord/lib/active_record/connection_adapters/trilogy_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/trilogy_adapter.rb @@ -202,11 +202,10 @@ def translate_exception(exception, message:, sql:, binds:) end case exception - when SocketError, IOError + when ::Trilogy::ConnectionClosed, ::Trilogy::EOFError return ConnectionFailed.new(message, connection_pool: @pool) when ::Trilogy::Error - if /TRILOGY_CLOSED_CONNECTION|TRILOGY_INVALID_SEQUENCE_ID|TRILOGY_UNEXPECTED_PACKET/.match?(exception.message) || - exception.is_a?(SystemCallError) + if exception.is_a?(SystemCallError) || exception.message.include?("TRILOGY_INVALID_SEQUENCE_ID") return ConnectionFailed.new(message, connection_pool: @pool) end end