Skip to content

Commit 91f4fdc

Browse files
authored
Merge pull request rails#50891 from composerinteralia/trilogy-error-translate
Clean up trilogy error translation
2 parents 68eade8 + adfdbf8 commit 91f4fdc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

activerecord/lib/active_record/connection_adapters/trilogy_adapter.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,10 @@ def translate_exception(exception, message:, sql:, binds:)
202202
end
203203

204204
case exception
205-
when SocketError, IOError
205+
when ::Trilogy::ConnectionClosed, ::Trilogy::EOFError
206206
return ConnectionFailed.new(message, connection_pool: @pool)
207207
when ::Trilogy::Error
208-
if /TRILOGY_CLOSED_CONNECTION|TRILOGY_INVALID_SEQUENCE_ID|TRILOGY_UNEXPECTED_PACKET/.match?(exception.message) ||
209-
exception.is_a?(SystemCallError)
208+
if exception.is_a?(SystemCallError) || exception.message.include?("TRILOGY_INVALID_SEQUENCE_ID")
210209
return ConnectionFailed.new(message, connection_pool: @pool)
211210
end
212211
end

0 commit comments

Comments
 (0)