From f5c0c7ffa09c3e29a6ba361d927f6c45f49d6425 Mon Sep 17 00:00:00 2001 From: Erol Fornoles Date: Sun, 22 May 2016 14:11:06 +0800 Subject: Introduce new ActiveRecord transaction error classes --- activerecord/lib/active_record/errors.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'activerecord/lib/active_record/errors.rb') diff --git a/activerecord/lib/active_record/errors.rb b/activerecord/lib/active_record/errors.rb index 38e4fbec8b..a317fb4d44 100644 --- a/activerecord/lib/active_record/errors.rb +++ b/activerecord/lib/active_record/errors.rb @@ -285,14 +285,24 @@ module ActiveRecord class TransactionIsolationError < ActiveRecordError end - # TransactionSerializationError will be raised when a transaction is rolled + # TransactionRollbackError will be raised when a transaction is rolled # back by the database due to a serialization failure or a deadlock. # # See the following: # # * http://www.postgresql.org/docs/current/static/transaction-iso.html # * https://dev.mysql.com/doc/refman/5.7/en/error-messages-server.html#error_er_lock_deadlock - class TransactionSerializationError < ActiveRecordError + class TransactionRollbackError < ActiveRecordError + end + + # SerializationFailure will be raised when a transaction is rolled + # back by the database due to a serialization failure. + class SerializationFailure < TransactionRollbackError + end + + # DeadlockDetected will be raised when a transaction is rolled + # back by the database when a deadlock is encountered. + class DeadlockDetected < TransactionRollbackError end # IrreversibleOrderError is raised when a relation's order is too complex for -- cgit v1.2.3