libmdbx  0.11.9.0 (2022-08-02T12:00:30+03:00)
One of the fastest compact embeddable key-value ACID database without WAL.
exceptions and errors

Classes

class  mdbx::exception_thunk
 Transfers C++ exceptions thru C callbacks. More...
 
class  mdbx::error
 Implements error information and throwing corresponding exceptions. More...
 
class  mdbx::exception
 Base class for all libmdbx's exceptions that are corresponds to libmdbx errors. More...
 
class  mdbx::fatal
 Fatal exception that lead termination anyway in dangerous unrecoverable cases. More...
 

Macros

#define MDBX_DECLARE_EXCEPTION(NAME)
 

Functions

LIBMDBX_API void mdbx::throw_too_small_target_buffer ()
 
LIBMDBX_API void mdbx::throw_max_length_exceeded ()
 
LIBMDBX_API void mdbx::throw_out_range ()
 
LIBMDBX_API void mdbx::throw_allocators_mismatch ()
 

Variables

 mdbx::bad_map_id
 
 mdbx::bad_transaction
 
 mdbx::bad_value_size
 
 mdbx::db_corrupted
 
 mdbx::db_full
 
 mdbx::db_invalid
 
 mdbx::db_too_large
 
 mdbx::db_unable_extend
 
 mdbx::db_version_mismatch
 
 mdbx::db_wanna_write_for_recovery
 
 mdbx::incompatible_operation
 
 mdbx::internal_page_full
 
 mdbx::internal_problem
 
 mdbx::key_exists
 
 mdbx::key_mismatch
 
 mdbx::max_maps_reached
 
 mdbx::max_readers_reached
 
 mdbx::multivalue
 
 mdbx::no_data
 
 mdbx::not_found
 
 mdbx::operation_not_permitted
 
 mdbx::permission_denied_or_not_writeable
 
 mdbx::reader_slot_busy
 
 mdbx::remote_media
 
 mdbx::something_busy
 
 mdbx::thread_mismatch
 
 mdbx::transaction_full
 
 mdbx::transaction_overlapping
 

Detailed Description


Class Documentation

◆ mdbx::exception_thunk

class mdbx::exception_thunk

Transfers C++ exceptions thru C callbacks.

Implements saving exceptions before returning from an C++'s environment to the intermediate C code and re-throwing after returning from C to the C++'s environment.

Public Member Functions

 exception_thunk () noexcept=default
 
 exception_thunk (const exception_thunk &)=delete
 
 exception_thunk (exception_thunk &&)=delete
 
exception_thunkoperator= (const exception_thunk &)=delete
 
exception_thunkoperator= (exception_thunk &&)=delete
 
bool is_clean () const noexcept
 
void capture () noexcept
 
void rethrow_captured () const
 

Constructor & Destructor Documentation

◆ exception_thunk() [1/3]

mdbx::exception_thunk::exception_thunk ( )
defaultnoexcept

◆ exception_thunk() [2/3]

mdbx::exception_thunk::exception_thunk ( const exception_thunk )
delete

◆ exception_thunk() [3/3]

mdbx::exception_thunk::exception_thunk ( exception_thunk &&  )
delete

Member Function Documentation

◆ operator=() [1/2]

exception_thunk& mdbx::exception_thunk::operator= ( const exception_thunk )
delete

◆ operator=() [2/2]

exception_thunk& mdbx::exception_thunk::operator= ( exception_thunk &&  )
delete

◆ mdbx::error

class mdbx::error

Implements error information and throwing corresponding exceptions.

Public Member Functions

 error (MDBX_error_t error_code) noexcept
 
 error (const error &)=default
 
 error (error &&)=default
 
erroroperator= (const error &)=default
 
erroroperator= (error &&)=default
 
bool is_success () const noexcept
 
bool is_result_true () const noexcept
 
bool is_result_false () const noexcept
 
bool is_failure () const noexcept
 
MDBX_error_t code () const noexcept
 Returns error code. More...
 
const char * what () const noexcept
 Returns message for MDBX's errors only and "SYSTEM" for others. More...
 
::std::string message () const
 Returns message for any errors. More...
 
bool is_mdbx_error () const noexcept
 Returns true for MDBX's errors. More...
 
void panic (const char *context_where_when, const char *func_who_what) const noexcept
 Panics on unrecoverable errors inside destructors etc. More...
 
void throw_exception () const
 
void throw_on_failure () const
 
void success_or_throw () const
 
void success_or_throw (const exception_thunk &) const
 
void panic_on_failure (const char *context_where, const char *func_who) const noexcept
 
void success_or_panic (const char *context_where, const char *func_who) const noexcept
 

Static Public Member Functions

static void throw_exception (int error_code)
 
static void throw_on_nullptr (const void *ptr, MDBX_error_t error_code)
 
static void success_or_throw (MDBX_error_t error_code)
 
static void success_or_throw (int error_code)
 
static void throw_on_failure (int error_code)
 
static bool boolean_or_throw (int error_code)
 
static void success_or_throw (int error_code, const exception_thunk &)
 
static void panic_on_failure (int error_code, const char *context_where, const char *func_who) noexcept
 
static void success_or_panic (int error_code, const char *context_where, const char *func_who) noexcept
 

Friends

bool operator== (const error &a, const error &b) noexcept
 
bool operator!= (const error &a, const error &b) noexcept
 

Constructor & Destructor Documentation

◆ error() [1/2]

mdbx::error::error ( const error )
default

◆ error() [2/2]

mdbx::error::error ( error &&  )
default

Member Function Documentation

◆ message()

::std::string mdbx::error::message ( ) const

Returns message for any errors.

◆ operator=() [1/2]

error& mdbx::error::operator= ( const error )
default

◆ operator=() [2/2]

error& mdbx::error::operator= ( error &&  )
default

◆ panic()

void mdbx::error::panic ( const char *  context_where_when,
const char *  func_who_what 
) const
noexcept

Panics on unrecoverable errors inside destructors etc.

◆ success_or_throw()

static void mdbx::error::success_or_throw ( int  error_code)
inlinestatic

◆ throw_exception()

void mdbx::error::throw_exception ( ) const

◆ what()

const char* mdbx::error::what ( ) const
noexcept

Returns message for MDBX's errors only and "SYSTEM" for others.

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const error a,
const error b 
)
friend

◆ operator==

bool operator== ( const error a,
const error b 
)
friend

◆ mdbx::exception

class mdbx::exception

Base class for all libmdbx's exceptions that are corresponds to libmdbx errors.

See also
MDBX_error_t

Inherits std::runtime_error.

Inherited by mdbx::fatal.

Public Member Functions

 exception (const ::mdbx::error &) noexcept
 
 exception (const exception &)=default
 
 exception (exception &&)=default
 
virtual ~exception () noexcept
 
const ::mdbx::error error () const noexcept
 

Constructor & Destructor Documentation

◆ exception() [1/3]

mdbx::exception::exception ( const ::mdbx::error )
noexcept

◆ exception() [2/3]

mdbx::exception::exception ( const exception )
default

◆ exception() [3/3]

mdbx::exception::exception ( exception &&  )
default

◆ ~exception()

virtual mdbx::exception::~exception ( )
virtualnoexcept

Member Function Documentation

◆ error()

const ::mdbx::error mdbx::exception::error ( ) const
inlinenoexcept

◆ mdbx::fatal

class mdbx::fatal

Fatal exception that lead termination anyway in dangerous unrecoverable cases.

Inherits mdbx::exception.

Public Member Functions

 fatal (const ::mdbx::error &) noexcept
 
 fatal (const exception &src) noexcept
 
 fatal (exception &&src) noexcept
 
 fatal (const fatal &src) noexcept
 
 fatal (fatal &&src) noexcept
 
fataloperator= (fatal &&)=default
 
fataloperator= (const fatal &)=default
 
virtual ~fatal () noexcept
 
- Public Member Functions inherited from mdbx::exception
 exception (const ::mdbx::error &) noexcept
 
 exception (const exception &)=default
 
 exception (exception &&)=default
 
virtual ~exception () noexcept
 
const ::mdbx::error error () const noexcept
 

Constructor & Destructor Documentation

◆ fatal() [1/5]

mdbx::fatal::fatal ( const ::mdbx::error )
noexcept

◆ fatal() [2/5]

mdbx::fatal::fatal ( const exception src)
inlinenoexcept

◆ fatal() [3/5]

mdbx::fatal::fatal ( exception &&  src)
inlinenoexcept

◆ fatal() [4/5]

mdbx::fatal::fatal ( const fatal src)
inlinenoexcept

◆ fatal() [5/5]

mdbx::fatal::fatal ( fatal &&  src)
inlinenoexcept

◆ ~fatal()

virtual mdbx::fatal::~fatal ( )
virtualnoexcept

Member Function Documentation

◆ operator=() [1/2]

fatal& mdbx::fatal::operator= ( const fatal )
default

◆ operator=() [2/2]

fatal& mdbx::fatal::operator= ( fatal &&  )
default

Macro Definition Documentation

◆ MDBX_DECLARE_EXCEPTION

#define MDBX_DECLARE_EXCEPTION (   NAME)
Value:
struct LIBMDBX_API_TYPE NAME : public exception { \
NAME(const ::mdbx::error &); \
virtual ~NAME() noexcept; \
}
#define LIBMDBX_API_TYPE
Definition: mdbx.h:650

Function Documentation

◆ throw_allocators_mismatch()

LIBMDBX_API void mdbx::throw_allocators_mismatch ( )

◆ throw_max_length_exceeded()

LIBMDBX_API void mdbx::throw_max_length_exceeded ( )

◆ throw_out_range()

LIBMDBX_API void mdbx::throw_out_range ( )

◆ throw_too_small_target_buffer()

LIBMDBX_API void mdbx::throw_too_small_target_buffer ( )

Variable Documentation

◆ bad_map_id

mdbx::bad_map_id

◆ bad_transaction

mdbx::bad_transaction

◆ bad_value_size

mdbx::bad_value_size

◆ db_corrupted

mdbx::db_corrupted

◆ db_full

mdbx::db_full

◆ db_invalid

mdbx::db_invalid

◆ db_too_large

mdbx::db_too_large

◆ db_unable_extend

mdbx::db_unable_extend

◆ db_version_mismatch

mdbx::db_version_mismatch

◆ db_wanna_write_for_recovery

mdbx::db_wanna_write_for_recovery

◆ incompatible_operation

mdbx::incompatible_operation

◆ internal_page_full

mdbx::internal_page_full

◆ internal_problem

mdbx::internal_problem

◆ key_exists

mdbx::key_exists

◆ key_mismatch

mdbx::key_mismatch

◆ max_maps_reached

mdbx::max_maps_reached

◆ max_readers_reached

mdbx::max_readers_reached

◆ multivalue

mdbx::multivalue

◆ no_data

mdbx::no_data

◆ not_found

mdbx::not_found

◆ operation_not_permitted

mdbx::operation_not_permitted

◆ permission_denied_or_not_writeable

mdbx::permission_denied_or_not_writeable

◆ reader_slot_busy

mdbx::reader_slot_busy

◆ remote_media

mdbx::remote_media

◆ something_busy

mdbx::something_busy

◆ thread_mismatch

mdbx::thread_mismatch

◆ transaction_full

mdbx::transaction_full

◆ transaction_overlapping

mdbx::transaction_overlapping