Error Strategy¶
Error handling strategy for SDK operations.
Controls how per-record errors are surfaced during execution:
Default (no argument): single-key operations raise immediately; batch / multi-key operations embed errors in the
RecordStream.ErrorStrategy.IN_STREAM: always embed errors as
RecordResultentries with non-OK result codes, even for single-key operations.ErrorHandler callback: errors are dispatched to the callback and excluded from the returned stream.
- class aerospike_sdk.error_strategy.ErrorStrategy[source]¶
Bases:
EnumStrategy for handling per-record errors during execution.
Pass to
execute(on_error=...)to override the default behavior.Example:
stream = await ( session.query(k1, k2).execute(on_error=ErrorStrategy.IN_STREAM) )
- IN_STREAM = 'in_stream'¶
Embed errors in the
RecordStreamasRecordResultentries.
- aerospike_sdk.error_strategy.ErrorHandler¶
Callback
(key, index, exception) -> Nonefor per-record error handling.The callback receives the failed record’s key, its position in the batch (0-based; 0 for single-key, -1 for queries), and the typed exception. Errors dispatched to the handler are excluded from the returned stream.
alias of
Callable[[Key,int,AerospikeError],None]
- aerospike_sdk.error_strategy.OnError¶
Type alias for the
on_errorparameter ofexecute().alias of
ErrorStrategy|Callable[[Key,int,AerospikeError],None]