Skip to content

Commit c52b1f7

Browse files
authored
Merge pull request #716 from midnight-wonderer/feature/connection-timeout-error-translation
Translate the connection timed out error
2 parents 107f862 + 74a532e commit c52b1f7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/active_record/connection_adapters/sqlserver_adapter.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def supports_savepoints?
156156
def supports_lazy_transactions?
157157
true
158158
end
159-
159+
160160
def supports_in_memory_oltp?
161161
@version_year >= 2014
162162
end
@@ -369,6 +369,8 @@ def translate_exception(e, message:, sql:, binds:)
369369
NoDatabaseError.new(message, sql: sql, binds: binds)
370370
when /data would be truncated/
371371
ValueTooLong.new(message, sql: sql, binds: binds)
372+
when /connection timed out/
373+
StatementTimeout.new(message, sql: sql, binds: binds)
372374
when /Column '(.*)' is not the same data type as referencing column '(.*)' in foreign key/
373375
pk_id, fk_id = SQLServer::Utils.extract_identifiers($1), SQLServer::Utils.extract_identifiers($2)
374376
MismatchedForeignKey.new(

0 commit comments

Comments
 (0)