diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-22 13:39:19 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-22 13:39:19 +0000 |
commit | f408fcd610c83d29effba92db29c35f7653187b6 (patch) | |
tree | c53038299ee114234e8adaf91512f228e156e0e3 /activerecord/lib/active_record/connection_adapters | |
parent | dbe8a26d7d22215054fc3630be95b81a16512fb8 (diff) | |
download | rails-f408fcd610c83d29effba92db29c35f7653187b6.tar.gz rails-f408fcd610c83d29effba92db29c35f7653187b6.tar.bz2 rails-f408fcd610c83d29effba92db29c35f7653187b6.zip |
Added more informative exceptions in establish_connection #356 [bitsweat]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@249 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rwxr-xr-x | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index d41356ffa4..a2fb480b8c 100755 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -86,14 +86,13 @@ module ActiveRecord if configuration = configurations[spec.to_s] establish_connection(configuration) else - raise AdapterNotSpecified + raise AdapterNotSpecified, "#{spec} database is not configured" end else spec = symbolize_strings_in_hash(spec) - unless spec.key?(:adapter) then raise AdapterNotSpecified end - + unless spec.key?(:adapter) then raise AdapterNotSpecified, "database configuration does not specify adapter" end adapter_method = "#{spec[:adapter]}_connection" - unless respond_to?(adapter_method) then raise AdapterNotFound end + unless respond_to?(adapter_method) then raise AdapterNotFound, "database configuration specifies nonexistent #{spec[:adapter]} adapter" end remove_connection establish_connection(ConnectionSpecification.new(spec, adapter_method)) end |