Error handling
For the complete documentation index see: llms.txt
All documentation pages available in markdown.
If an error occurs as a result of a database operation, an AerospikeException is thrown.
The AerospikeException.Result property describes the exact cause of the error given by the Aerospike server.
Other client-side error conditions are:
AerospikeException.QueryTerminated— Query prematurely terminated.AerospikeException.Connection— Client can’t connect to the server.AerospikeException.Timeout— Database request expired before completing.
Server error details
Aerospike Database 8.2.0 and later can attach structured error details (a numeric subcode, a message, and an expression trace) to failures. The Aerospike C# client 8.5.0 and later supports reading those details. Enable them by setting errorDetailVerbosity (a plain int, default 0) on Policy, which WritePolicy and other command policies inherit, then read the subcode from the AerospikeException your client raises:
var policy = new Policy();policy.errorDetailVerbosity = 2;
try{ client.Get(policy, key);}catch (AerospikeException ae){ Console.WriteLine($"status={ae.Result} subcode={ae.SubCode} message={ae.Message}");}AerospikeException.SubCode is the numeric subcode, or 0 when the server didn’t return one. Dispatch on the (Result, SubCode) pair, never the subcode alone, and see Error subcodes. ExpTrace (ExpressionTrace) carries a verbosity-3 expression trace when the failure involved an expression, or null when the server didn’t attach one. See Expression traces for the trace shape.
See Server error details for verbosity levels, coverage, and operator caps.