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))
Added 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
Trueif it is possible that the command succeeded. See In Doubt Status.
In addition to accessing these attributes by their names, they can also be checked by calling
exc.args[i], whereexcis the exception object andiis the index of the attribute in the order they appear above. For example, runexc.args[4]to get thein_doubtflag.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.
Error code:
-1
- exception aerospike.exception.ParamError
The operation was not performed because of invalid parameters.
Error code:
-2Subclass of
ClientError.
- exception aerospike.exception.InvalidHostError
Host name could not be found in DNS lookup.
Error code:
-4Subclass of
ClientError.
- exception aerospike.exception.ClientAbortError
Query or scan was aborted in user’s callback.
Error code:
-5Subclass of
ClientError.
- exception aerospike.exception.InvalidNodeError
Node invalid or could not be found.
Error code:
-8Subclass of
ClientError.
- exception aerospike.exception.TLSError
TLS error occurred.
Error code:
-9Subclass of
ClientError.
- exception aerospike.exception.ConnectionError
Synchronous connection error.
Error code:
-10Subclass of
ClientError.
- exception aerospike.exception.MaxRetriesExceeded
Max retries limit reached.
Error code:
-12Subclass of
ClientError.
- exception aerospike.exception.MaxErrorRateExceeded
The operation was not performed because the maximum error rate has been exceeded.
Error code:
-14Subclass of
ClientError.
- exception aerospike.exception.NoResponse
No response received from server.
Error code:
-15Subclass of
ClientError.
- exception aerospike.exception.BatchFailed
One or more keys failed in a batch.
Error code:
-16Subclass of
ClientError.
- exception aerospike.exception.TransactionFailed
Transaction failed.
Error code:
-17Subclass of
ClientError.
- exception aerospike.exception.TransactionAlreadyCommitted
Transaction abort called, but the transaction was already committed.
Error code:
-18Subclass of
ClientError.
- exception aerospike.exception.TransactionAlreadyAborted
Transaction commit called, but the transaction was already aborted.
Error code:
-19Subclass of
ClientError.
Server Errors
- exception aerospike.exception.ServerError
The parent class for all errors returned from the cluster.
Error code:
1
- exception aerospike.exception.InvalidRequest
Request protocol invalid, or invalid protocol field.
Error code:
4Subclass of
ServerError.
- exception aerospike.exception.ServerFull
The server node is running out of memory and/or storage device space reserved for the specified namespace.
Error code:
8Subclass of
ServerError.
- exception aerospike.exception.AlwaysForbidden
Operation not allowed in current configuration.
Error code:
10Subclass of
ServerError.
- exception aerospike.exception.ScanAbortedError
Scan aborted by user.
Error code:
15Subclass of
ServerError.
- exception aerospike.exception.UnsupportedFeature
Encountered an unimplemented server feature.
Error code:
16Subclass of
ServerError.
- exception aerospike.exception.DeviceOverload
The server node’s storage device(s) can’t keep up with the write load.
Error code:
18Subclass of
ServerError.
- exception aerospike.exception.NamespaceNotFound
Namespace in request not found on server.
Error code:
20Subclass of
ServerError.
- exception aerospike.exception.ForbiddenError
Operation not allowed at this time.
Error code:
22Subclass of
ServerError.
- exception aerospike.exception.ElementExistsError
Raised when trying to alter a map key which already exists, when using a
create_onlypolicy.Error code:
23Subclass of
ServerError.
- exception aerospike.exception.ElementNotFoundError
Raised when trying to alter a map key which does not exist, when using an
update_onlypolicy.Error code:
24Subclass of
ServerError.
- exception aerospike.exception.OpNotApplicable
The operation cannot be applied to the current bin value on the server.
Error code:
26Subclass of
ServerError.
- exception aerospike.exception.FilteredOut
The command was not performed because the expression was false.
Error code:
27Subclass of
ServerError.
- exception aerospike.exception.LostConflict
Write command loses conflict to XDR.
Error code:
28Subclass of
ServerError.
- exception aerospike.exception.BatchDisabledError
Batch functionality has been disabled.
Error code:
150Subclass of
ServerError.
- exception aerospike.exception.BatchMaxRequestError
Batch max requests have been exceeded.
Error code:
151Subclass of
ServerError.
- exception aerospike.exception.BatchQueueFullError
All batch queues are full.
Error code:
152Subclass of
ServerError.
- exception aerospike.exception.InvalidGeoJSON
Invalid/Unsupported GeoJSON.
Error code:
160Subclass of
ServerError.
- exception aerospike.exception.QueryAbortedError
Query was aborted.
Error code:
210Subclass 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.RecordNotFound
Record does not exist in database. May be returned by either a read or a write with the policy
aerospike.POLICY_EXISTS_UPDATE.Error code:
2Subclass of
RecordError.
- exception aerospike.exception.RecordGenerationError
Generation of record in database does not satisfy write policy.
Error code:
3Subclass of
RecordError.
- exception aerospike.exception.RecordExistsError
Record already exists. May be returned by a write with policy
aerospike.POLICY_EXISTS_CREATE.Error code:
5Subclass of
RecordError.
- exception aerospike.exception.BinExistsError
Bin already exists on a create-only operation.
Error code:
6Subclass 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).
Error code:
12Subclass of
RecordError.
- exception aerospike.exception.RecordTooBig
Record being (re-)written can’t fit in a storage write block.
Error code:
13Subclass of
RecordError.
- exception aerospike.exception.RecordBusy
Too may concurrent requests for one record - a “hot-key” situation.
Error code:
14Subclass of
RecordError.
- exception aerospike.exception.BinNotFound
Bin not found on update-only operation.
Error code:
17Subclass of
RecordError.
- exception aerospike.exception.RecordKeyMismatch
Record key sent with command did not match key stored on server.
Error code:
19Subclass of
RecordError.
- exception aerospike.exception.BinNameError
Either length of bin name exceeds the limit of 15 characters, or namespace’s bin name quota was exceeded.
Error code:
21Subclass of
RecordError.
Index Errors
- exception aerospike.exception.IndexError
The parent class for secondary index exceptions.
Error code:
204- name
The name of the index associated with the error.
Subclass of
ServerError.
- exception aerospike.exception.IndexFoundError
Error code:
200Subclass of
IndexError.
- exception aerospike.exception.IndexNotFound
Error code:
201Subclass of
IndexError.
- exception aerospike.exception.IndexOOM
The index is out of memory.
Error code:
202Subclass of
IndexError.
- exception aerospike.exception.IndexNotReadable
Error code:
203Subclass of
IndexError.
- exception aerospike.exception.IndexNameMaxLen
Index name is too long.
Error code:
205Subclass of
IndexError.
- exception aerospike.exception.IndexNameMaxCount
Reached the maximum allowed number of indexes.
Error code:
206Subclass of
IndexError.
Query Errors
- exception aerospike.exception.QueryQueueFull
Query processing queue is full.
Error code:
211Subclass of
QueryError.
- exception aerospike.exception.QueryTimeout
Secondary index query timed out on server.
Error code:
212Subclass of
QueryError.
- exception aerospike.exception.QueryError
Exception class for query errors.
Error code:
213Subclass of
ServerError.
Cluster Errors
- 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-changeflag set.Error code:
7Subclass of
ClusterError.
- exception aerospike.exception.ClusterError
Cluster discovery and connection errors.
Error code:
11Subclass of
ServerError.
Admin Errors
- exception aerospike.exception.AdminError
The parent class for exceptions of the security API.
Subclass of
ServerError.
- exception aerospike.exception.SecurityNotSupported
Security functionality not supported by connected server.
Error code:
51Subclass of
AdminError.
- exception aerospike.exception.SecurityNotEnabled
Security functionality not enabled by connected server.
Error code:
52Subclass of
AdminError.
- exception aerospike.exception.SecuritySchemeNotSupported
Security scheme not supported.
Error code:
53Subclass of
AdminError.
- exception aerospike.exception.InvalidCommand
Administration command is invalid.
Error code:
54Subclass of
AdminError.
- exception aerospike.exception.InvalidField
Administration field is invalid.
Error code:
55Subclass of
AdminError.
- exception aerospike.exception.IllegalState
Security protocol not followed.
Error code:
56Subclass of
AdminError.
- exception aerospike.exception.InvalidUser
User name is invalid.
Error code:
60Subclass of
AdminError.
- exception aerospike.exception.UserExistsError
User was previously created.
Error code:
61Subclass of
AdminError.
- exception aerospike.exception.InvalidPassword
Error code:
62Subclass of
AdminError.
- exception aerospike.exception.ExpiredPassword
Error code:
63Subclass of
AdminError.
- exception aerospike.exception.ForbiddenPassword
Forbidden password (e.g. recently used)
Error code:
64Subclass of
AdminError.
- exception aerospike.exception.InvalidCredential
Security credential is invalid.
Error code:
65Subclass of
AdminError.
- exception aerospike.exception.InvalidRole
Role name is invalid.
Error code:
70Subclass of
AdminError.
- exception aerospike.exception.RoleExistsError
Role already exists.
Error code:
71Subclass of
AdminError.
- exception aerospike.exception.InvalidPrivilege
Error code:
72Subclass of
AdminError.
- exception aerospike.exception.InvalidWhitelist
Invalid IP whitelist.
Error code:
73Subclass of
AdminError.
- exception aerospike.exception.QuotasNotEnabled
Quotas not enabled on server.
Error code:
74Subclass of
AdminError.
- exception aerospike.exception.InvalidQuota
Error code:
75Subclass of
AdminError.
- exception aerospike.exception.NotAuthenticated
User must be authenticated before performing database operations.
Error code:
80Subclass of
AdminError.
- exception aerospike.exception.RoleViolation
User does not possess the required role to perform the database operation.
Error code:
81Subclass of
AdminError.
- exception aerospike.exception.NotWhitelisted
Command not allowed because sender IP not whitelisted.
Error code:
82Subclass of
AdminError.
- exception aerospike.exception.QuotaExceeded
Error code:
83Subclass of
AdminError.
UDF Errors
- exception aerospike.exception.UDFError
The parent class for UDF exceptions exceptions.
Error code:
100Subclass of
ServerError.- module
The UDF module associated with the error.
- func
Optionally the name of the UDF function.
In Doubt Status
The
in-doubtstatus 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])
Added in version 3.0.1.