Permalink
Browse files

Added more informative exceptions in establish_connection #356 [bitsw…

…eat]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@249 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent dbe8a26 commit f408fcd610c83d29effba92db29c35f7653187b6 @dhh dhh committed Dec 22, 2004
View
@@ -1,5 +1,7 @@
*SVN*
+* Added more informative exceptions in establish_connection #356 [bitsweat]
+
* Fixed that options[:counter_sql] was overwritten with interpolated sql rather than original sql #355 [bitsweat]
* Fixed that overriding an attribute's accessor would be disregarded by add_on_empty and add_on_boundary_breaking because they simply used
@@ -86,14 +86,13 @@ def self.establish_connection(spec = nil)
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

0 comments on commit f408fcd

Please sign in to comment.