Module: Moped::Failover::Reconfigure

Extended by:
Reconfigure
Included in:
Reconfigure
Defined in:
lib/moped/failover/reconfigure.rb

Overview

Reconfigure is for exceptions that indicate that a replica set was potentially reconfigured in the middle of an operation.

Since:

  • 2.0.0

Instance Method Summary collapse

Instance Method Details

#execute(exception, node) ⇒ Object

Executes the failover strategy. In the case of reconfigure, we check if the failure was due to a replica set reconfiguration mid operation and raise a new error if appropriate.

Examples:

Execute the reconfigure strategy.

Moped::Failover::Reconfigure.execute(exception, node)

Parameters:

  • exception (Exception)

    The raised exception.

  • node (Node)

    The node the exception got raised on.

Raises:

  • (Exception, Errors::ReplicaSetReconfigure)

    The exception that was previously thrown or a reconfiguration error.

Since:

  • 2.0.0



26
27
28
29
30
31
32
33
# File 'lib/moped/failover/reconfigure.rb', line 26

def execute(exception, node)
  if exception.reconfiguring_replica_set?
    raise(Errors::ReplicaSetReconfigured.new(exception.command, exception.details))
  elsif exception.connection_failure?
    raise Errors::ConnectionFailure.new(exception.inspect)
  end
  raise(exception)
end