aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-01-14 17:58:17 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2014-01-17 14:09:27 -0800
commit1543863548bcd7515fac7b7b1931b6e23fedf80f (patch)
tree5a25c17216426372ee1e1bb0a27dc6fcda943424 /activerecord
parent9bc303cae2693c4394abb8363ed4dbdd9638bde3 (diff)
downloadrails-1543863548bcd7515fac7b7b1931b6e23fedf80f.tar.gz
rails-1543863548bcd7515fac7b7b1931b6e23fedf80f.tar.bz2
rails-1543863548bcd7515fac7b7b1931b6e23fedf80f.zip
fix exception translation
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract_adapter.rb5
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb2
2 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
index d1acef3e53..3c94bad208 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -349,11 +349,12 @@ module ActiveRecord
protected
- def translate_exception(e, sql)
+ def translate_exception_class(e, sql)
message = "#{e.class.name}: #{e.message}: #{sql}"
@logger.error message if @logger
exception = translate_exception(e, message)
exception.set_backtrace e.backtrace
+ exception
end
def log(sql, name = "SQL", binds = [], statement_name = nil)
@@ -365,7 +366,7 @@ module ActiveRecord
:statement_name => statement_name,
:binds => binds) { yield }
rescue => e
- raise translate_exception(e, sql)
+ raise translate_exception_class(e, sql)
end
def translate_exception(exception, message)
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index ebbe918442..a471383041 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -856,7 +856,7 @@ module ActiveRecord
begin
@connection.prepare nextkey, sql
rescue => e
- raise translate_exception(e, sql)
+ raise translate_exception_class(e, sql)
end
# Clear the queue
@connection.get_last_result