diff options
author | kennyj <kennyj@gmail.com> | 2013-03-01 01:55:20 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2013-03-01 02:47:57 +0900 |
commit | e2a4b7a506e36839771284942829cbbe8d40b377 (patch) | |
tree | 7401e84147410032910b6669e7e4bc9484af53d2 /activerecord/lib | |
parent | 8f6b70f1fd49b8520a744cc90102051043faf315 (diff) | |
download | rails-e2a4b7a506e36839771284942829cbbe8d40b377.tar.gz rails-e2a4b7a506e36839771284942829cbbe8d40b377.tar.bz2 rails-e2a4b7a506e36839771284942829cbbe8d40b377.zip |
Wrong exception is occured when raising no translatable exception
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index b39eb058ae..c91e1b3fb9 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -675,6 +675,8 @@ module ActiveRecord UNIQUE_VIOLATION = "23505" def translate_exception(exception, message) + return exception unless exception.respond_to?(:result) + case exception.result.try(:error_field, PGresult::PG_DIAG_SQLSTATE) when UNIQUE_VIOLATION RecordNotUnique.new(message, exception) |