All operations that interact with the Aerospike cluster accept an as_error argument and return an as_status value. The as_error argument is populated with information about the error that occurred. The as_status return value is the as_error.code value.
When an operation succeeds, the as_error.code value is usually set to AEROSPIKE_OK
. There are some operations which may have other success status codes, so please review each operation for information on status codes.
When as_error.code is not a success value (AEROSPIKE_OK
), then you can expect the other fields of as_error.code to be populated.
Example usage:
You can reuse an as_error with multiple operations. Each operation internally resets the error. So, if an error occurred in one operation, and you did not check it, then the error will be lost with subsequent operations.
Example usage:
Definition at line 97 of file as_error.h.
#include "as_error.h"
Data Fields | |
as_status | code |
const char * | file |
const char * | func |
bool | in_doubt |
uint32_t | line |
char | message [AS_ERROR_MESSAGE_MAX_SIZE] |
Related Functions | |
(Note that these are not member functions.) | |
static void | as_error_append (as_error *err, const char *str) |
static void | as_error_copy (as_error *trg, const as_error *src) |
static as_error * | as_error_init (as_error *err) |
static as_status | as_error_reset (as_error *err) |
static void | as_error_set_in_doubt (as_error *err, bool is_read, uint32_t command_sent_counter) |
static as_status | as_error_setall (as_error *err, as_status code, const char *message, const char *func, const char *file, uint32_t line) |
static as_status | as_error_setallv (as_error *err, as_status code, const char *func, const char *file, uint32_t line, const char *fmt,...) |
AS_EXTERN char * | as_error_string (as_status status) |
|
related |
Initialize the error to default (empty) values, returning the error.
err | The error to initialize. |
Definition at line 168 of file as_error.h.
References AEROSPIKE_OK, code, file, func, in_doubt, line, and message.
Resets the error to default (empty) values, returning the status code.
err | The error to reset. |
Definition at line 190 of file as_error.h.
References AEROSPIKE_OK, code, file, func, in_doubt, line, and message.
|
related |
Set whether it is possible that the write transaction may have completed even though this exception was generated. This may be the case when a client error occurs (like timeout) after the command was sent to the server.
Definition at line 253 of file as_error.h.
References AEROSPIKE_ERR_TIMEOUT, code, and in_doubt.
|
related |
Sets the error.
Definition at line 209 of file as_error.h.
References AS_ERROR_MESSAGE_MAX_SIZE, as_string::as_strncpy(), code, file, func, in_doubt, line, and message.
|
related |
Sets the error.
Definition at line 228 of file as_error.h.
References AS_ERROR_MESSAGE_MAX_LEN, code, file, func, in_doubt, line, and message.
Return string representation of error code. Result should not be freed.
as_status as_error::code |
Numeric error code
Definition at line 102 of file as_error.h.
const char* as_error::file |
Name of the file where the error occurred.
Definition at line 117 of file as_error.h.
const char* as_error::func |
Name of the function where the error occurred.
Definition at line 112 of file as_error.h.
bool as_error::in_doubt |
Is it possible that the write transaction completed even though this error was generated. This may be the case when a client error occurs (like timeout) after the command was sent to the server.
Definition at line 129 of file as_error.h.
uint32_t as_error::line |
Line in the file where the error occurred.
Definition at line 122 of file as_error.h.
char as_error::message[AS_ERROR_MESSAGE_MAX_SIZE] |
NULL-terminated error message
Definition at line 107 of file as_error.h.