[][src]Function pgx::guard

pub fn guard<Func, R>(f: Func) -> R where
    Func: FnOnce() -> R + UnwindSafe + RefUnwindSafe

Guard a closure such that Rust Panics are properly converted into Postgres ERRORs

Generally, this function won't need to be used directly, as it's also the implementation behind the #[pg_guard] and #[pg_extern] macros. Which means the function you'd like to guard is likely already guarded.

This function is re-entrant and will properly "bubble-up" panics or errors to the top-level before they're converted into Postgres ERRORs