Cppgres
Build Postgres extensions in C++
Loading...
Searching...
No Matches
exception.hpp
Go to the documentation of this file.
1
4#pragma once
5
6namespace cppgres {
7class pg_exception : public std::exception {
8 ::MemoryContext mcxt;
9 ::MemoryContext error_cxt;
10 ::ErrorData *error;
11
12 pg_exception(::MemoryContext mcxt);
13
14 const char *what() const noexcept override { return error->message; }
15
16 template <typename Func> friend struct ffi_guard;
17
18public:
19 const char *message() const noexcept { return error->message; }
20
26 const ::ErrorData *error_data() const noexcept { return error; }
27
39 [[noreturn]] void rethrow();
40
42};
43} // namespace cppgres
Definition: exception.hpp:7
void rethrow()
Re-throws the captured error as a Postgres error, with every field (SQLSTATE, detail,...
Definition: exception_impl.hpp:22
const ::ErrorData * error_data() const noexcept
The complete error record captured from Postgres.
Definition: exception.hpp:26
Definition: guard.hpp:20