class Mongo::Error::InvalidTransactionOperation
Exception raised if an invalid operation is attempted as part of a transaction.
@since 2.6.0
Constants
- INVALID_READ_PREFERENCE
The error message for when a transaction read operation uses a non-primary read preference.
@since 2.6.0
- NO_TRANSACTION_STARTED
The error message for when a user attempts to commit or abort a transaction when none is in progress.
@since 2.6.0
- TRANSACTION_ALREADY_IN_PROGRESS
The error message for when a user attempts to start a transaction when one is already in progress.
@since 2.6.0.
- UNACKNOWLEDGED_WRITE_CONCERN
The error message for when a transaction is started with an unacknowledged write concern.
@since 2.6.0
Public Class Methods
Create an error message for incorrectly running a transaction operation that cannot be run after the previous one.
@example Create the error message.
InvalidTransactionOperation.cannot_call_after(last_op, current_op)
@param [ Symbol
] last_op The operation which was run before. @param [ Symbol
] current_op The operation which cannot be run.
@since 2.6.0
# File lib/mongo/error/invalid_transaction_operation.rb, line 77 def self.cannot_call_after_msg(last_op, current_op) "Cannot call #{current_op} after calling #{last_op}" end
Create an error message for incorrectly running a transaction operation twice.
@example Create the error message.
InvalidTransactionOperation.cannot_call_twice(op)
@param [ Symbol
] op The operation which was run twice.
@since 2.6.0
# File lib/mongo/error/invalid_transaction_operation.rb, line 63 def self.cannot_call_twice_msg(op) "cannot call #{op} twice" end
Instantiate the new exception.
@example Instantiate the exception.
Mongo::Error::InvalidTransactionOperation.new(msg)
@since 2.6.0
Mongo::Error::new
# File lib/mongo/error/invalid_transaction_operation.rb, line 51 def initialize(msg) super(msg) end