Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit 790420b

Browse files
committed
[doxygen] add description for "exception" group
1 parent 668e8cb commit 790420b

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

doc/groups_definitions.dox

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,30 @@
163163
/** @defgroup data_view Data View*/
164164
/** @defgroup synchronization Synchronization Primitives*/
165165
/** @defgroup primitives Primitives*/
166-
/** @defgroup exceptions Exceptions*/
166+
/** @defgroup exceptions Exceptions
167+
* Possible exceptions that could be thrown by the libpmemobj++.
168+
*
169+
* In runtime, some operations may fail, then all you need is to catch the exception.
170+
* Every pmem exception has **std::runtime_error** in its inheritance tree
171+
* and contains proper message with an error description.
172+
* All exceptions can be caught using just **std::runtime_error**.
173+
* Look at the list on this page to explore all exceptions with their descriptions.
174+
*
175+
* Transaction handles uncaught exceptions thrown inside its scope, then aborts
176+
* and rethrow the previous exception. That way you never loose the original
177+
* exception and at the same time, the transaction state is handled
178+
* properly by the library.
179+
*
180+
* Let's consider following example:
181+
* @snippet examples/mpsc_queue/mpsc_queue.cpp mpsc_main
182+
*
183+
* There are plenty of try-catch blocks placed to handle possible errors that can happen in some conditions.
184+
* E.g. @ref pmem::obj::pool<T>::open can lead to @ref pmem::pool_error.
185+
* Next exception, **std::exception**, is placed to handle possible errors during allocation,
186+
* coming from @ref pmem::obj::make_persistent. Worth being careful using every new function
187+
* because some of exceptions are not obvious, e.g., pmem::obj::pool<T>::close
188+
* at the end of the code which may throw **std::logic_error**.
189+
*
190+
* You should check every function you will use in context of possible
191+
* exceptions and then handle them to avoid crash.
192+
**/

examples/mpsc_queue/mpsc_queue.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ single_threaded(pmem::obj::pool<root> pop)
8080

8181
//! [mpsc_queue_single_threaded_example]
8282

83+
//! [mpsc_main]
8384
int
8485
main(int argc, char *argv[])
8586
{
@@ -120,3 +121,4 @@ main(int argc, char *argv[])
120121
}
121122
return 0;
122123
}
124+
//! [mpsc_main]

0 commit comments

Comments
 (0)