From 58ba48e4b35c840f56b4fcbb6c8e4b489d785e15 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 22 Feb 2014 09:18:53 -0700 Subject: Distinguish ConnectionNotEstablished messages: no conn pool for the class, or no conn available from the pool --- .../active_record/connection_adapters/abstract/connection_pool.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index 759e162e19..fd185de589 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -538,7 +538,10 @@ module ActiveRecord # for (not necessarily the current class). def retrieve_connection(klass) #:nodoc: pool = retrieve_connection_pool(klass) - (pool && pool.connection) or raise ConnectionNotEstablished + raise ConnectionNotEstablished, "No connection pool for #{klass}" unless pool + conn = pool.connection + raise ConnectionNotEstablished, "No connection for #{klass} in connection pool" unless conn + conn end # Returns true if a connection that's accessible to this class has -- cgit v1.2.3