Cppgres
Build Postgres extensions in C++
Loading...
Searching...
No Matches
cppgres::exception_guard< Func > Struct Template Reference

Wraps a C++ function to catch exceptions and report them as Postgres errors. More...

#include <guard.hpp>

Public Member Functions

 exception_guard (Func f)
 
template<typename... Args>
auto operator() (Args &&...args) -> decltype(func(std::forward< Args >(args)...))
 

Public Attributes

Func func
 

Detailed Description

template<typename Func>
struct cppgres::exception_guard< Func >

Wraps a C++ function to catch exceptions and report them as Postgres errors.

It ensures that if the C++ exception throws an error, it'll be caught and transformed into a Postgres error report.

Note
It will also handle Postgres errors caught during the call that were automatically transformed into cppgres::pg_exception by cppgres::ffi_guard and report them as errors.
Template Parameters
FuncC++ function to call

The documentation for this struct was generated from the following file: