lib/redis_cluster/errors.rb in redis_cluster-0.2.9 vs lib/redis_cluster/errors.rb in redis_cluster-0.3.0

- old
+ new

@@ -1,7 +1,26 @@ module RedisCluster - NotSupportError = Class.new StandardError + class CommandNotSupportedError < StandardError + def initialize(command) + super("Command #{command} is not supported for Redis Cluster") + end + end - KeysNotAtSameSlotError = Class.new StandardError + class KeysNotAtSameSlotError < StandardError + def initialize(keys) + super("Keys must map to the same Redis Cluster slot when using " \ + "EVAL/EVALSHA. Consider using Redis Cluster 'hash tags' (see " \ + "documentation). Keys: #{keys}") + end + end - KeyNotAppointError = Class.new StandardError + class KeysNotSpecifiedError < StandardError + def initialize(command) + super("Keys must be specified for command #{command}") + end + end + + # These error classes were renamed. These aliases are here for backwards + # compatibility. + KeyNotAppointError = KeysNotSpecifiedError + NotSupportError = CommandNotSupportedError end