Skip to content

Commit 74a532e

Browse files
Translate the connection timed out error
1 parent e6e0f29 commit 74a532e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/active_record/connection_adapters/sqlserver_adapter.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def supports_savepoints?
154154
def supports_lazy_transactions?
155155
true
156156
end
157-
157+
158158
def supports_in_memory_oltp?
159159
@version_year >= 2014
160160
end
@@ -367,6 +367,8 @@ def translate_exception(e, message:, sql:, binds:)
367367
NoDatabaseError.new(message, sql: sql, binds: binds)
368368
when /data would be truncated/
369369
ValueTooLong.new(message, sql: sql, binds: binds)
370+
when /connection timed out/
371+
StatementTimeout.new(message, sql: sql, binds: binds)
370372
when /Column '(.*)' is not the same data type as referencing column '(.*)' in foreign key/
371373
pk_id, fk_id = SQLServer::Utils.extract_identifiers($1), SQLServer::Utils.extract_identifiers($2)
372374
MismatchedForeignKey.new(

0 commit comments

Comments
 (0)