File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
ArJdbc ::ConnectionMethods . module_eval do
3
3
def sqlite3_connection ( config )
4
+ raise ArgumentError , 'Configuration must not be empty' if config . blank?
5
+
4
6
config = config . deep_dup
5
7
config [ :adapter_spec ] ||= ::ArJdbc ::SQLite3
6
8
config [ :adapter_class ] = ActiveRecord ::ConnectionAdapters ::SQLite3Adapter unless config . key? ( :adapter_class )
@@ -18,7 +20,7 @@ def sqlite3_connection(config)
18
20
parse_sqlite3_config! ( config )
19
21
rescue Errno ::ENOENT => error
20
22
if error . message . include? ( 'No such file or directory' )
21
- raise ActiveRecord ::NoDatabaseError
23
+ raise ActiveRecord ::NoDatabaseError . new ( connection_pool : ActiveRecord :: ConnectionAdapters :: NullPool . new )
22
24
else
23
25
raise
24
26
end
@@ -50,7 +52,10 @@ def sqlite3_connection(config)
50
52
51
53
timeout = config [ :timeout ]
52
54
if timeout && timeout . to_s !~ /\A \d +\Z /
53
- raise TypeError . new "Timeout must be nil or a number (got: #{ timeout } )."
55
+ raise ActiveRecord ::StatementInvalid . new (
56
+ "TypeError: Timeout must be nil or a number (got: #{ timeout } )." ,
57
+ connection_pool : ActiveRecord ::ConnectionAdapters ::NullPool . new
58
+ )
54
59
end
55
60
56
61
options = config [ :properties ]
You can’t perform that action at this time.
0 commit comments