|
Cppgres
Build Postgres extensions in C++
|
Scope guard that runs the callable only when the scope is left via an exception. More...
#include <guard.hpp>
Public Member Functions | |
| scope_fail (Func f, const char *warning_message) | |
| scope_fail (const scope_fail &)=delete | |
| scope_fail & | operator= (const scope_fail &)=delete |
| scope_fail (scope_fail &&)=delete | |
| scope_fail & | operator= (scope_fail &&)=delete |
Public Attributes | |
| Func | func |
| const char * | warning_message |
| int | uncaught = std::uncaught_exceptions() |
Scope guard that runs the callable only when the scope is left via an exception.
A scope-fail guard (per std::uncaught_exceptions): the destructor compares the number of in-flight exceptions against the count captured at construction and, only when the scope is being unwound by an exception, runs the callable through cppgres::ffi_guard_noexcept — so the cleanup itself never throws, degrading any failure to a WARNING with the given message.