aerospike.exception
— Aerospike Exceptions
Example
This is a simple example on how to catch an exception thrown by the Aerospike client:
import aerospike
from aerospike import exception as ex
try:
config = { 'hosts': [ ('127.0.0.1', 3000)], 'policies': { 'total_timeout': 1200}}
client = aerospike.client(config)
client.close()
except ex.AerospikeError as e:
print("Error: {0} [{1}]".format(e.msg, e.code))
New in version 1.0.44.
Base Class
- exception aerospike.exception.AerospikeError
The parent class of all exceptions raised by the Aerospike client.
An exception of this class type must have the following attributes:
- code
The associated status code.
- msg
The human-readable error message.
- file
File where the exception occurred.
- line
Line in the file where the exception occurred.
- in_doubt
True
if it is possible that the operation succeeded. See In Doubt Status.
In addition to accessing these attributes by their names, they can also be checked by calling
exc.args[i]
, whereexc
is the exception object andi
is the index of the attribute in the order they appear above. For example, runexc.args[4]
to get thein_doubt
flag.Inherits from
exceptions.Exception
.
Client Errors
- exception aerospike.exception.ClientError
Exception class for client-side errors, often due to misconfiguration or misuse of the API methods.
- exception aerospike.exception.InvalidHostError
Subclass of
ClientError
.
- exception aerospike.exception.ParamError
The operation was not performed because of invalid parameters.
Subclass of
ClientError
.
- exception aerospike.exception.MaxErrorRateExceeded
The operation was not performed because the maximum error rate has been exceeded.
Subclass of
ClientError
.
- exception aerospike.exception.ClientAbortError
Query or scan was aborted in user’s callback.
Subclass of
ClientError
.
- exception aerospike.exception.InvalidNodeError
Node invalid or could not be found.
Subclass of
ClientError
.
- exception aerospike.exception.TLSError
TLS error occurred.
Subclass of
ClientError
.
- exception aerospike.exception.MaxRetriesExceeded
Max retries limit reached.
Subclass of
ClientError
.
- exception aerospike.exception.NoResponse
No response received from server.
Subclass of
ClientError
.
- exception aerospike.exception.BatchFailed
One or more keys failed in a batch.
Subclass of
ClientError
.
- exception aerospike.exception.ConnectionError
Synchronous connection error.
Subclass of
ClientError
.
- exception aerospike.exception.QueryAbortedError
Query was aborted.
Subclass of
ClientError
.
Server Errors
- exception aerospike.exception.ServerError
The parent class for all errors returned from the cluster.
- exception aerospike.exception.InvalidRequest
Protocol-level error.
Subclass of
ServerError
.
- exception aerospike.exception.OpNotApplicable
The operation cannot be applied to the current bin value on the server.
Subclass of
ServerError
.
- exception aerospike.exception.FilteredOut
The transaction was not performed because the expression was false.
Subclass of
ServerError
.
- exception aerospike.exception.ServerFull
The server node is running out of memory and/or storage device space reserved for the specified namespace.
Subclass of
ServerError
.
- exception aerospike.exception.AlwaysForbidden
Operation not allowed in current configuration.
Subclass of
ServerError
.
- exception aerospike.exception.UnsupportedFeature
Encountered an unimplemented server feature.
Subclass of
ServerError
.
- exception aerospike.exception.DeviceOverload
The server node’s storage device(s) can’t keep up with the write load.
Subclass of
ServerError
.
- exception aerospike.exception.NamespaceNotFound
Namespace in request not found on server.
Subclass of
ServerError
.
- exception aerospike.exception.ForbiddenError
Operation not allowed at this time.
Subclass of
ServerError
.
- exception aerospike.exception.ElementExistsError
Raised when trying to alter a map key which already exists, when using a
create_only
policy.Subclass of
ServerError
.
- exception aerospike.exception.ElementNotFoundError
Raised when trying to alter a map key which does not exist, when using an
update_only
policy.Subclass of
ServerError
.
- exception aerospike.exception.BatchQueueFullError
All batch queues are full.
Subclass of
ServerError
.
- exception aerospike.exception.BatchMaxRequestError
Batch max requests have been exceeded.
Subclass of
ServerError
.
- exception aerospike.exception.BatchDisabledError
Batch functionality has been disabled.
Subclass of
ServerError
.
- exception aerospike.exception.ScanAbortedError
Scan aborted by user.
Subclass of
ServerError
.
- exception aerospike.exception.LostConflict
Write command loses conflict to XDR.
Subclass of
ServerError
.
- exception aerospike.exception.InvalidGeoJSON
Invalid/Unsupported GeoJSON.
Subclass of
ServerError
.
Record Errors
- exception aerospike.exception.RecordError
The parent class for record and bin exceptions exceptions associated with read and write operations.
- key
The key identifying the record.
- bin
(Optional) the bin associated with the error.
Subclass of
ServerError
.
- exception aerospike.exception.RecordKeyMismatch
Record key sent with transaction did not match key stored on server.
Subclass of
RecordError
.
- exception aerospike.exception.RecordNotFound
Record does not exist in database. May be returned by either a read or a write with the policy
aerospike.POLICY_EXISTS_UPDATE
.Subclass of
RecordError
.
- exception aerospike.exception.RecordGenerationError
Generation of record in database does not satisfy write policy.
Subclass of
RecordError
.
- exception aerospike.exception.RecordExistsError
Record already exists. May be returned by a write with policy
aerospike.POLICY_EXISTS_CREATE
.Subclass of
RecordError
.
- exception aerospike.exception.RecordBusy
Too may concurrent requests for one record - a “hot-key” situation.
Subclass of
RecordError
.
- exception aerospike.exception.RecordTooBig
Record being (re-)written can’t fit in a storage write block.
Subclass of
RecordError
.
- exception aerospike.exception.BinNameError
Length of bin name exceeds the limit of 15 characters.
Subclass of
RecordError
.
- exception aerospike.exception.BinIncompatibleType
Bin modification operation can’t be done on an existing bin due to its value type (for example appending to an integer).
Subclass of
RecordError
.
- exception aerospike.exception.BinNotFound
Bin not found on update-only operation.
Subclass of
RecordError
.
- exception aerospike.exception.BinExistsError
Bin already exists on a create-only operation.
Subclass of
RecordError
.
Index Errors
- exception aerospike.exception.IndexError
The parent class for indexing exceptions.
- index_name
The name of the index associated with the error.
Subclass of
ServerError
.
- exception aerospike.exception.IndexNotFound
Subclass of
IndexError
.
- exception aerospike.exception.IndexFoundError
Subclass of
IndexError
.
- exception aerospike.exception.IndexOOM
The index is out of memory.
Subclass of
IndexError
.
- exception aerospike.exception.IndexNotReadable
Subclass of
IndexError
.
- exception aerospike.exception.IndexNameMaxLen
Subclass of
IndexError
.
- exception aerospike.exception.IndexNameMaxCount
Reached the maximum allowed number of indexes.
Subclass of
IndexError
.
Query Errors
- exception aerospike.exception.QueryError
Exception class for query errors.
Subclass of
AerospikeError
.
- exception aerospike.exception.QueryQueueFull
Subclass of
QueryError
.
- exception aerospike.exception.QueryTimeout
Subclass of
QueryError
.
Cluster Errors
- exception aerospike.exception.ClusterError
Cluster discovery and connection errors.
Subclass of
AerospikeError
.
- exception aerospike.exception.ClusterChangeError
A cluster state change occurred during the request. This may also be returned by scan operations with the
fail-on-cluster-change
flag set.Subclass of
ClusterError
.
Admin Errors
- exception aerospike.exception.AdminError
The parent class for exceptions of the security API.
- exception aerospike.exception.ExpiredPassword
Subclass of
AdminError
.
- exception aerospike.exception.ForbiddenPassword
Subclass of
AdminError
.
- exception aerospike.exception.IllegalState
Subclass of
AdminError
.
- exception aerospike.exception.InvalidCommand
Subclass of
AdminError
.
- exception aerospike.exception.InvalidCredential
Subclass of
AdminError
.
- exception aerospike.exception.InvalidField
Subclass of
AdminError
.
- exception aerospike.exception.InvalidPassword
Subclass of
AdminError
.
- exception aerospike.exception.InvalidPrivilege
Subclass of
AdminError
.
- exception aerospike.exception.InvalidRole
Subclass of
AdminError
.
- exception aerospike.exception.InvalidUser
Subclass of
AdminError
.
- exception aerospike.exception.QuotasNotEnabled
Subclass of
AdminError
.
- exception aerospike.exception.QuotaExceeded
Subclass of
AdminError
.
- exception aerospike.exception.InvalidQuota
Subclass of
AdminError
.
- exception aerospike.exception.NotWhitelisted
Subclass of
AdminError
.
- exception aerospike.exception.InvalidWhitelist
Subclass of
AdminError
.
- exception aerospike.exception.NotAuthenticated
Subclass of
AdminError
.
- exception aerospike.exception.RoleExistsError
Subclass of
AdminError
.
- exception aerospike.exception.RoleViolation
Subclass of
AdminError
.
- exception aerospike.exception.SecurityNotEnabled
Subclass of
AdminError
.
- exception aerospike.exception.SecurityNotSupported
Subclass of
AdminError
.
- exception aerospike.exception.SecuritySchemeNotSupported
Subclass of
AdminError
.
- exception aerospike.exception.UserExistsError
Subclass of
AdminError
.
UDF Errors
- exception aerospike.exception.UDFError
The parent class for UDF exceptions exceptions.
Subclass of
ServerError
.- module
The UDF module associated with the error.
- func
Optionally the name of the UDF function.
Exception Hierarchy
AerospikeError (*)
+-- TimeoutError (9)
+-- ClientError (-1)
| +-- InvalidHost (-4)
| +-- ParamError (-2)
+-- ServerError (1)
+-- InvalidRequest (4)
+-- ServerFull (8)
+-- AlwaysForbidden (10)
+-- UnsupportedFeature (16)
+-- DeviceOverload (18)
+-- NamespaceNotFound (20)
+-- ForbiddenError (22)
+-- ElementNotFoundError (23)
+-- ElementExistsError (24)
+-- RecordError (*)
| +-- RecordKeyMismatch (19)
| +-- RecordNotFound (2)
| +-- RecordGenerationError (3)
| +-- RecordExistsError (5)
| +-- RecordTooBig (13)
| +-- RecordBusy (14)
| +-- BinNameError (21)
| +-- BinIncompatibleType (12)
+-- IndexError (204)
| +-- IndexNotFound (201)
| +-- IndexFoundError (200)
| +-- IndexOOM (202)
| +-- IndexNotReadable (203)
| +-- IndexNameMaxLen (205)
| +-- IndexNameMaxCount (206)
+-- QueryError (213)
| +-- QueryQueueFull (211)
| +-- QueryTimeout (212)
+-- ClusterError (11)
| +-- ClusterChangeError (7)
+-- AdminError (*)
| +-- SecurityNotSupported (51)
| +-- SecurityNotEnabled (52)
| +-- SecuritySchemeNotSupported (53)
| +-- InvalidCommand (54)
| +-- InvalidField (55)
| +-- IllegalState (56)
| +-- InvalidUser (60)
| +-- UserExistsError (61)
| +-- InvalidPassword (62)
| +-- ExpiredPassword (63)
| +-- ForbiddenPassword (64)
| +-- InvalidCredential (65)
| +-- InvalidRole (70)
| +-- RoleExistsError (71)
| +-- RoleViolation (81)
| +-- InvalidPrivilege (72)
| +-- NotAuthenticated (80)
+-- UDFError (*)
+-- UDFNotFound (1301)
+-- LuaFileNotFound (1302)
In Doubt Status
The
in-doubt
status of a caught exception can be checked by looking at the 5th element of its args tuple:key = 'test', 'demo', 1 record = {'some': 'thing'} try: client.put(key, record) except AerospikeError as exc: print("The in doubt nature of the operation is: {}".format(exc.args[4])
New in version 3.0.1.