#include <setjmp.h>
#include <exception>
#include <iostream>
#include <utility>
#include "error.hpp"
#include "exception.hpp"
#include "utils/function_traits.hpp"
Go to the source code of this file.
|
| template<typename Func > |
| void | cppgres::ffi_guard_noexcept (Func f, const char *warning_message) noexcept |
| | Runs a callable under cppgres::ffi_guard, degrading any failure to a warning.
|
| |
|
template<typename Func > |
| | cppgres::scope_fail (Func, const char *) -> scope_fail< Func > |
| |
|
template<typename Func > |
| | cppgres::scope_exit (Func, const char *) -> scope_exit< Func > |
| |
◆ ffi_guard_noexcept()
template<typename Func >
| void cppgres::ffi_guard_noexcept |
( |
Func |
f, |
|
|
const char * |
warning_message |
|
) |
| |
|
noexcept |
Runs a callable under cppgres::ffi_guard, degrading any failure to a warning.
Catches every exception — including Postgres errors surfaced as cppgres::pg_exception — and reports the given message with elog(WARNING) instead of propagating. Intended for destructors and other cleanup paths where failure must degrade to a WARNING instead of propagating.
- Parameters
-
| f | callable to run |
| warning_message | message to report at WARNING level if the callable fails |