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], where exc is the exception object and i is the index of the attribute in the order they appear above. For example, run exc.args[4] to get the in_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.

Error code: -1

exception aerospike.exception.ParamError

The operation was not performed because of invalid parameters.

Error code: -2

Subclass of ClientError.

exception aerospike.exception.InvalidHostError

Host name could not be found in DNS lookup.

Error code: -4

Subclass of ClientError.

exception aerospike.exception.ClientAbortError

Query or scan was aborted in user’s callback.

Error code: -5

Subclass of ClientError.

exception aerospike.exception.InvalidNodeError

Node invalid or could not be found.

Error code: -8

Subclass of ClientError.

exception aerospike.exception.TLSError

TLS error occurred.

Error code: -9

Subclass of ClientError.

exception aerospike.exception.ConnectionError

Synchronous connection error.

Error code: -10

Subclass of ClientError.

exception aerospike.exception.MaxRetriesExceeded

Max retries limit reached.

Error code: -12

Subclass of ClientError.

exception aerospike.exception.MaxErrorRateExceeded

The operation was not performed because the maximum error rate has been exceeded.

Error code: -14

Subclass of ClientError.

exception aerospike.exception.NoResponse

No response received from server.

Error code: -15

Subclass of ClientError.

exception aerospike.exception.BatchFailed

One or more keys failed in a batch.

Error code: -16

Subclass 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: 4

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.

Error code: 8

Subclass of ServerError.

exception aerospike.exception.AlwaysForbidden

Operation not allowed in current configuration.

Error code: 10

Subclass of ServerError.

exception aerospike.exception.ScanAbortedError

Scan aborted by user.

Error code: 15

Subclass of ServerError.

exception aerospike.exception.UnsupportedFeature

Encountered an unimplemented server feature.

Error code: 16

Subclass of ServerError.

exception aerospike.exception.DeviceOverload

The server node’s storage device(s) can’t keep up with the write load.

Error code: 18

Subclass of ServerError.

exception aerospike.exception.NamespaceNotFound

Namespace in request not found on server.

Error code: 20

Subclass of ServerError.

exception aerospike.exception.ForbiddenError

Operation not allowed at this time.

Error code: 22

Subclass of ServerError.

exception aerospike.exception.ElementExistsError

Raised when trying to alter a map key which already exists, when using a create_only policy.

Error code: 23

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.

Error code: 24

Subclass of ServerError.

exception aerospike.exception.OpNotApplicable

The operation cannot be applied to the current bin value on the server.

Error code: 26

Subclass of ServerError.

exception aerospike.exception.FilteredOut

The transaction was not performed because the expression was false.

Error code: 27

Subclass of ServerError.

exception aerospike.exception.LostConflict

Write command loses conflict to XDR.

Error code: 28

Subclass of ServerError.

exception aerospike.exception.BatchDisabledError

Batch functionality has been disabled.

Error code: 150

Subclass of ServerError.

exception aerospike.exception.BatchMaxRequestError

Batch max requests have been exceeded.

Error code: 151

Subclass of ServerError.

exception aerospike.exception.BatchQueueFullError

All batch queues are full.

Error code: 152

Subclass of ServerError.

exception aerospike.exception.InvalidGeoJSON

Invalid/Unsupported GeoJSON.

Error code: 160

Subclass of ServerError.

exception aerospike.exception.QueryAbortedError

Query was aborted.

Error code: 210

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.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: 2

Subclass of RecordError.

exception aerospike.exception.RecordGenerationError

Generation of record in database does not satisfy write policy.

Error code: 3

Subclass of RecordError.

exception aerospike.exception.RecordExistsError

Record already exists. May be returned by a write with policy aerospike.POLICY_EXISTS_CREATE.

Error code: 5

Subclass of RecordError.

exception aerospike.exception.BinExistsError

Bin already exists on a create-only operation.

Error code: 6

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).

Error code: 12

Subclass of RecordError.

exception aerospike.exception.RecordTooBig

Record being (re-)written can’t fit in a storage write block.

Error code: 13

Subclass of RecordError.

exception aerospike.exception.RecordBusy

Too may concurrent requests for one record - a “hot-key” situation.

Error code: 14

Subclass of RecordError.

exception aerospike.exception.BinNotFound

Bin not found on update-only operation.

Error code: 17

Subclass of RecordError.

exception aerospike.exception.RecordKeyMismatch

Record key sent with transaction did not match key stored on server.

Error code: 19

Subclass 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: 21

Subclass of RecordError.

Index Errors

exception aerospike.exception.IndexError

The parent class for secondary index exceptions.

Error code: 204

index_name

The name of the index associated with the error.

Subclass of ServerError.

exception aerospike.exception.IndexFoundError

Error code: 200

Subclass of IndexError.

exception aerospike.exception.IndexNotFound

Error code: 201

Subclass of IndexError.

exception aerospike.exception.IndexOOM

The index is out of memory.

Error code: 202

Subclass of IndexError.

exception aerospike.exception.IndexNotReadable

Error code: 203

Subclass of IndexError.

exception aerospike.exception.IndexNameMaxLen

Index name is too long.

Error code: 205

Subclass of IndexError.

exception aerospike.exception.IndexNameMaxCount

Reached the maximum allowed number of indexes.

Error code: 206

Subclass of IndexError.

Query Errors

exception aerospike.exception.QueryQueueFull

Query processing queue is full.

Error code: 211

Subclass of QueryError.

exception aerospike.exception.QueryTimeout

Secondary index query timed out on server.

Error code: 212

Subclass of QueryError.

exception aerospike.exception.QueryError

Exception class for query errors.

Error code: 213

Subclass 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-change flag set.

Error code: 7

Subclass of ClusterError.

exception aerospike.exception.ClusterError

Cluster discovery and connection errors.

Error code: 11

Subclass 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: 51

Subclass of AdminError.

exception aerospike.exception.SecurityNotEnabled

Security functionality not enabled by connected server.

Error code: 52

Subclass of AdminError.

exception aerospike.exception.SecuritySchemeNotSupported

Security type not supported by connected server.

Error code: 53

Subclass of AdminError.

exception aerospike.exception.InvalidCommand

Administration command is invalid.

Error code: 54

Subclass of AdminError.

exception aerospike.exception.InvalidField

Administration field is invalid.

Error code: 55

Subclass of AdminError.

exception aerospike.exception.IllegalState

Security protocol not followed.

Error code: 56

Subclass of AdminError.

exception aerospike.exception.InvalidUser

User name is invalid.

Error code: 60

Subclass of AdminError.

exception aerospike.exception.UserExistsError

User was previously created.

Error code: 61

Subclass of AdminError.

exception aerospike.exception.InvalidPassword

Error code: 62

Subclass of AdminError.

exception aerospike.exception.ExpiredPassword

Error code: 63

Subclass of AdminError.

exception aerospike.exception.ForbiddenPassword

Forbidden password (e.g. recently used)

Error code: 64

Subclass of AdminError.

exception aerospike.exception.InvalidCredential

Security credential is invalid.

Error code: 65

Subclass of AdminError.

exception aerospike.exception.InvalidRole

Role name is invalid.

Error code: 70

Subclass of AdminError.

exception aerospike.exception.RoleExistsError

Role already exists.

Error code: 71

Subclass of AdminError.

exception aerospike.exception.InvalidPrivilege

Error code: 72

Subclass of AdminError.

exception aerospike.exception.InvalidWhitelist

Invalid IP whitelist.

Error code: 73

Subclass of AdminError.

exception aerospike.exception.QuotasNotEnabled

Quotas not enabled on server.

Error code: 74

Subclass of AdminError.

exception aerospike.exception.InvalidQuota

Error code: 75

Subclass of AdminError.

exception aerospike.exception.NotAuthenticated

User must be authentication before performing database operations.

Error code: 80

Subclass of AdminError.

exception aerospike.exception.RoleViolation

User does not possess the required role to perform the database operation.

Error code: 81

Subclass of AdminError.

exception aerospike.exception.NotWhitelisted

Command not allowed because sender IP not whitelisted.

Error code: 82

Subclass of AdminError.

exception aerospike.exception.QuotaExceeded

Error code: 83

Subclass of AdminError.

UDF Errors

exception aerospike.exception.UDFError

The parent class for UDF exceptions exceptions.

Error code: 100

Subclass of ServerError.

module

The UDF module associated with the error.

func

Optionally the name of the UDF function.

exception aerospike.exception.UDFNotFound

UDF does not exist.

Error code: 1301

Subclass of UDFError.

exception aerospike.exception.LuaFileNotFound

LUA file does not exist.

Error code: 1302

Subclass of UDFError.

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.