Module: TransactionReliability
- Extended by:
- Helpers
- Defined in:
- lib/transaction_reliability.rb,
lib/transaction_reliability/version.rb
Overview
Provide utilities for the (more) reliable handling of database errors related to concurrency or connectivity.
Currently only handles Postgresql and Mysql, assuming use of the PG and Mysql2 drivers respectively
Defined Under Namespace
Modules: Helpers Classes: ConcurrencyError, ConnectionLost, DeadlockDetected, SerializationFailure, TransientTransactionError
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
-
.rewrap_exception(exception) ⇒ Object
Unwrap ActiveRecord::StatementInvalid into some more specific exceptions that we define.
Methods included from Helpers
transaction_with_retry, with_transaction_retry
Class Method Details
.rewrap_exception(exception) ⇒ Object
Unwrap ActiveRecord::StatementInvalid into some more specific exceptions that we define.
Only defined for Mysql2 and PG drivers at the moment
149 150 151 152 153 154 155 156 157 |
# File 'lib/transaction_reliability.rb', line 149 def self.rewrap_exception(exception) if exception..start_with?('PG::') || exception.class.name.start_with?('PG::') rewrap_pg_exception exception elsif exception. =~ /^mysql2::/i rewrap_mysql2_exception exception else exception end end |