Cppgres
Build Postgres extensions in C++
Loading...
Searching...
No Matches
cppgres::pg_exception Class Reference
Inheritance diagram for cppgres::pg_exception:

Public Member Functions

const char * message () const noexcept
 
const ::ErrorData * error_data () const noexcept
 The complete error record captured from Postgres.
 
void rethrow ()
 Re-throws the captured error as a Postgres error, with every field (SQLSTATE, detail, hint, context, ...) intact.
 

Friends

template<typename Func >
struct ffi_guard
 

Member Function Documentation

◆ error_data()

const ::ErrorData * cppgres::pg_exception::error_data ( ) const
inlinenoexcept

The complete error record captured from Postgres.

Valid for the lifetime of the exception object.

◆ rethrow()

void cppgres::pg_exception::rethrow ( )
inline

Re-throws the captured error as a Postgres error, with every field (SQLSTATE, detail, hint, context, ...) intact.

Intended to be called from a catch block once cleanup is done and the error should continue propagating to Postgres. Never returns.

The longjmp does not run this object's destructor, so the exception's backing storage is handed to Postgres to be released when ErrorContext is reset — that is, once the error has been fully handled.


The documentation for this class was generated from the following files: