异常(Exceptions)

Core exceptions raised by the Redis client

exception redis.exceptions.AskError(resp)[源代码]

Error indicated ASK error received from cluster. When a slot is set as MIGRATING, the node will accept all queries that pertain to this hash slot, but only if the key in question exists, otherwise the query is forwarded using a -ASK redirection to the node that is target of the migration.

src node: MIGRATING to dst node

get > ASK error ask dst node > ASKING command

dst node: IMPORTING from src node

asking command only affects next command any op will be allowed after asking command

exception redis.exceptions.AuthenticationError[源代码]
exception redis.exceptions.AuthenticationWrongNumberOfArgsError[源代码]

An error to indicate that the wrong number of args were sent to the AUTH command

exception redis.exceptions.AuthorizationError[源代码]
exception redis.exceptions.BusyLoadingError[源代码]
exception redis.exceptions.ChildDeadlockedError[源代码]

Error indicating that a child process is deadlocked after a fork()

exception redis.exceptions.ClusterCrossSlotError[源代码]

Error indicated CROSSSLOT error received from cluster. A CROSSSLOT error is generated when keys in a request don't hash to the same slot.

exception redis.exceptions.ClusterDownError(resp)[源代码]

Error indicated CLUSTERDOWN error received from cluster. By default Redis Cluster nodes stop accepting queries if they detect there is at least a hash slot uncovered (no available node is serving it). This way if the cluster is partially down (for example a range of hash slots are no longer covered) the entire cluster eventually becomes unavailable. It automatically returns available as soon as all the slots are covered again.

exception redis.exceptions.ClusterError[源代码]

Cluster errors occurred multiple times, resulting in an exhaustion of the command execution TTL

exception redis.exceptions.ConnectionError[源代码]
exception redis.exceptions.DataError[源代码]
exception redis.exceptions.ExecAbortError[源代码]
exception redis.exceptions.InvalidResponse[源代码]
exception redis.exceptions.LockError(message=None, lock_name=None)[源代码]

Errors acquiring or releasing a lock

exception redis.exceptions.LockNotOwnedError(message=None, lock_name=None)[源代码]

Error trying to extend or release a lock that is (no longer) owned

exception redis.exceptions.MasterDownError(resp)[源代码]

Error indicated MASTERDOWN error received from cluster. Link with MASTER is down and replica-serve-stale-data is set to 'no'.

exception redis.exceptions.MaxConnectionsError[源代码]
exception redis.exceptions.ModuleError[源代码]
exception redis.exceptions.MovedError(resp)[源代码]

Error indicated MOVED error received from cluster. A request sent to a node that doesn't serve this key will be replayed with a MOVED error that points to the correct node.

exception redis.exceptions.NoPermissionError[源代码]
exception redis.exceptions.NoScriptError[源代码]
exception redis.exceptions.OutOfMemoryError[源代码]
Indicates the database is full. Can only occur when either:
  • Redis maxmemory-policy=noeviction

  • Redis maxmemory-policy=volatile* and there are no evictable keys

For more information see Memory optimization in Redis. # noqa

exception redis.exceptions.PubSubError[源代码]
exception redis.exceptions.ReadOnlyError[源代码]
exception redis.exceptions.RedisClusterException[源代码]

Base exception for the RedisCluster client

exception redis.exceptions.RedisError[源代码]
exception redis.exceptions.ResponseError[源代码]
exception redis.exceptions.SlotNotCoveredError[源代码]

This error only happens in the case where the connection pool will try to fetch what node that is covered by a given slot.

If this error is raised the client should drop the current node layout and attempt to reconnect and refresh the node layout again

exception redis.exceptions.TimeoutError[源代码]
exception redis.exceptions.TryAgainError(*args, **kwargs)[源代码]

Error indicated TRYAGAIN error received from cluster. Operations on keys that don't exist or are - during resharding - split between the source and destination nodes, will generate a -TRYAGAIN error.

exception redis.exceptions.WatchError[源代码]