Skip to content

Commit 39c26d4

Browse files
committed
Fix rescue constants for optional connection gems. Fixes #475.
1 parent e562a67 commit 39c26d4

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## v4.2.14
2+
3+
#### Fixed
4+
5+
* Fix rescue constants for optional connection gems. Fixes #475.
6+
7+
18
## v4.2.13
29

310
#### Fixed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.2.13
1+
4.2.14

lib/active_record/connection_adapters/sqlserver_adapter.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def active?
133133
return false unless @connection
134134
raw_connection_do 'SELECT 1'
135135
true
136-
rescue TinyTds::Error, ODBC::Error
136+
rescue *connection_errors
137137
false
138138
end
139139

@@ -307,6 +307,13 @@ def connect
307307
configure_connection
308308
end
309309

310+
def connection_errors
311+
@connection_errors ||= [].tap do |errors|
312+
errors << TinyTds::Error if defined?(TinyTds::Error)
313+
errors << ODBC::Error if defined?(ODBC::Error)
314+
end
315+
end
316+
310317
def dblib_connect(config)
311318
TinyTds::Client.new(
312319
dataserver: config[:dataserver],

0 commit comments

Comments
 (0)