Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 47 lines (40 sloc) 1.279 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
module RedisFailover
  # Base class for all RedisFailover errors.
  class Error < StandardError
  end

  # Raised when a node is specified incorrectly.
  class InvalidNodeError < Error
  end

  # Raised when a node changes to an invalid/unknown state.
  class InvalidNodeStateError < Error
    def initialize(node, state)
      super("Invalid state change `#{state}` for node #{node}")
    end
  end

  # Raised when a node is unavailable (i.e., unreachable via network).
  class NodeUnavailableError < Error
    def initialize(node)
      super("Node: #{node}")
    end
  end

  # Raised when no master is currently available.
  class NoMasterError < Error
  end

  # Raised when no slave is currently available.
  class NoSlaveError < Error
  end

  # Raised when a redis server is no longer using the same role
  # as previously assumed.
  class InvalidNodeRoleError < Error
    def initialize(node, assumed, actual)
      super("Invalid role detected for node #{node}, client thought " +
        "it was a #{assumed}, but it's now a #{actual}")
    end
  end

  # Raised when an unsupported redis operation is performed.
  class UnsupportedOperationError < Error
    def initialize(operation)
      super("Operation `#{operation}` is currently unsupported")
    end
  end
end
Something went wrong with that request. Please try again.