class ActiveRecord::Deadlocked 
        
        Deadlocked will be raised when a transaction is rolled back by the database when a deadlock is encountered.
This is a subclass of TransactionRollbackError, please make sure to check its documentation to be aware of its caveats.