Sha256: 75e7e8d94331b2f91896b5399f8f88dd1abbf5e238816aca56ade6a99ef4a420

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

module RedisFailover
  class Error < StandardError
    attr_reader :original
    def initialize(msg = nil, original = $!)
      super(msg)
      @original = original
    end
  end

  class InvalidNodeError < Error
  end

  class InvalidNodeStateError < Error
    def initialize(node, state)
      super("Invalid state change `#{state}` for node #{node}")
    end
  end

  class NodeUnavailableError < Error
    def initialize(node)
      super("Node: #{node}")
    end
  end

  class NoMasterError < Error
  end

  class NoSlaveError < Error
  end

  class FailoverServerUnavailableError < Error
    def initialize(failover_server_url)
      super("Unable to access #{failover_server_url}")
    end
  end

  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

  class UnsupportedOperationError < Error
    def initialize(operation)
      super("Operation `#{operation}` is currently unsupported")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redis_failover-0.4.0 lib/redis_failover/errors.rb