LiteCore
Couchbase Lite cross-platform core implementation
|
Data Structures | |
struct | C4Error |
An error value. More... | |
Macros | |
#define | kC4NoError ((C4Error){}) |
Functions | |
CBL_CORE_API FLStringResult | c4error_getMessage (C4Error error) |
Returns an error message describing a C4Error. | |
CBL_CORE_API FLSliceResult | c4error_getDescription (C4Error error) |
Returns a description of an error, including the domain and code as well as the message. | |
CBL_CORE_API char * | c4error_getDescriptionC (C4Error error, char *outBuffer, size_t bufferSize) |
Returns a description of an error, including the domain and code as well as the message. | |
CBL_CORE_API void | c4error_setCaptureBacktraces (bool) |
If set to true , then when a C4Error is created the current thread's stack backtrace will be captured along with it, and can later be examined by calling c4error_getBacktrace. | |
CBL_CORE_API bool | c4error_getCaptureBacktraces (void) |
CBL_CORE_API FLStringResult | c4error_getBacktrace (C4Error error) |
Returns the stack backtrace, if any, associated with a C4Error. | |
NODISCARD CBL_CORE_API C4Error | c4error_make (C4ErrorDomain domain, int code, FLString message) |
Creates a C4Error struct with the given domain and code, and associates the message with it. | |
NODISCARD CBL_CORE_API C4Error | c4error_printf (C4ErrorDomain domain, int code, const char *format,...) __printflike(3 |
Creates a C4Error struct with the given domain and code, formats the message as with printf , and associates the message with the error. | |
NODISCARD CBL_CORE_API C4Error NODISCARD CBL_CORE_API C4Error | c4error_vprintf (C4ErrorDomain domain, int code, const char *format, va_list args) __printflike(3 |
Same as c4error_printf, but with a premade va_list . | |
NODISCARD CBL_CORE_API C4Error NODISCARD CBL_CORE_API C4Error CBL_CORE_API void | c4error_return (C4ErrorDomain domain, int code, FLString message, C4Error *outError) |
Creates and stores a C4Error in *outError , if not NULL. | |
CBL_CORE_API bool | c4error_mayBeTransient (C4Error err) |
Returns true if this is a network error that may be transient, i.e. | |
CBL_CORE_API bool | c4error_mayBeNetworkDependent (C4Error err) |
Returns true if this error might go away when the network environment changes, i.e. | |
#define kC4NoError ((C4Error){}) |
enum C4ErrorCode : int32_t |
enum C4ErrorDomain : uint8_t |
enum C4NetworkErrorCode : int32_t |
CBL_CORE_API FLStringResult c4error_getBacktrace | ( | C4Error | error | ) |
Returns the stack backtrace, if any, associated with a C4Error.
This is formatted in human-readable form similar to a debugger or crash log.
CBL_CORE_API bool c4error_getCaptureBacktraces | ( | void | ) |
CBL_CORE_API FLSliceResult c4error_getDescription | ( | C4Error | error | ) |
Returns a description of an error, including the domain and code as well as the message.
Remember to free the result.
CBL_CORE_API char * c4error_getDescriptionC | ( | C4Error | error, |
char * | outBuffer, | ||
size_t | bufferSize ) |
Returns a description of an error, including the domain and code as well as the message.
The description is copied to the buffer as a C string. It will not write past the end of the buffer; the message will be truncated if necessary.
error | The error to describe |
outBuffer | Where to write the C string to |
bufferSize | The size of the buffer |
CBL_CORE_API FLStringResult c4error_getMessage | ( | C4Error | error | ) |
Returns an error message describing a C4Error.
Remember to free the result.
NODISCARD CBL_CORE_API C4Error c4error_make | ( | C4ErrorDomain | domain, |
int | code, | ||
FLString | message ) |
Creates a C4Error struct with the given domain and code, and associates the message with it.
CBL_CORE_API bool c4error_mayBeNetworkDependent | ( | C4Error | err | ) |
Returns true if this error might go away when the network environment changes, i.e.
the client should retry after notification of a network status change.
CBL_CORE_API bool c4error_mayBeTransient | ( | C4Error | err | ) |
Returns true if this is a network error that may be transient, i.e.
the client should retry after a delay.
NODISCARD CBL_CORE_API C4Error c4error_printf | ( | C4ErrorDomain | domain, |
int | code, | ||
const char * | format, | ||
... ) |
Creates a C4Error struct with the given domain and code, formats the message as with printf
, and associates the message with the error.
NODISCARD CBL_CORE_API C4Error NODISCARD CBL_CORE_API C4Error CBL_CORE_API void c4error_return | ( | C4ErrorDomain | domain, |
int | code, | ||
FLString | message, | ||
C4Error * | outError ) |
CBL_CORE_API void c4error_setCaptureBacktraces | ( | bool | ) |
If set to true
, then when a C4Error is created the current thread's stack backtrace will be captured along with it, and can later be examined by calling c4error_getBacktrace.
Even if false, some errors (like assertion failures) will still have backtraces.
NODISCARD CBL_CORE_API C4Error NODISCARD CBL_CORE_API C4Error c4error_vprintf | ( | C4ErrorDomain | domain, |
int | code, | ||
const char * | format, | ||
va_list | args ) |
Same as c4error_printf, but with a premade va_list
.