diff options
author | Erol Fornoles <erol.fornoles@gmail.com> | 2016-05-21 19:25:01 +0800 |
---|---|---|
committer | Erol Fornoles <erol.fornoles@gmail.com> | 2016-05-21 21:51:52 +0800 |
commit | 4d525a6f7569d1c90811f6d5e326321fb6f25015 (patch) | |
tree | 5a0b57e7afcf884cf0b9b43eb49e948c7896f1ea /activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | |
parent | 694cbbf801e46d7ec533ece4637412838f02723e (diff) | |
download | rails-4d525a6f7569d1c90811f6d5e326321fb6f25015.tar.gz rails-4d525a6f7569d1c90811f6d5e326321fb6f25015.tar.bz2 rails-4d525a6f7569d1c90811f6d5e326321fb6f25015.zip |
Add AR::TransactionSerializationError for transaction serialization failures or deadlocks
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 3 |
1 files changed, 3 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 bab80a8890..ddfc560747 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -406,6 +406,7 @@ module ActiveRecord VALUE_LIMIT_VIOLATION = "22001" FOREIGN_KEY_VIOLATION = "23503" UNIQUE_VIOLATION = "23505" + SERIALIZATION_FAILURE = "40001" def translate_exception(exception, message) return exception unless exception.respond_to?(:result) @@ -417,6 +418,8 @@ module ActiveRecord InvalidForeignKey.new(message) when VALUE_LIMIT_VIOLATION ValueTooLong.new(message) + when SERIALIZATION_FAILURE + TransactionSerializationError.new(message) else super end |