libfsafe  0.1.1
eases writing fail-safe code (C++)
/home/ptr/dev/dev-libs/libfsafe/libfsafe/checkpoint.hxx File Reference

Contains declaration of CHECKPOINT. More...

#include <libsex/utility.hxx>
#include <libfsafe/UnexpectedException.hxx>

Go to the source code of this file.


#define CHECKPOINT(statement)
 Marks an important statement in the program flow.

Detailed Description

Contains declaration of CHECKPOINT.

Definition in file checkpoint.hxx.

Define Documentation

#define CHECKPOINT (   statement)
try { \
        statement; \
} catch (libsex::Exception& e) { \
        throw libsex::formatted<libfsafe::UnexpectedException>(e, __FILE__, __LINE__, #statement); \

Marks an important statement in the program flow.

The marked statement is executed. In the default case (the statement being successfull) nothing else will happen. If the statement throws an exception, it will be wrapped into anther exception that contains the location and the statement itsself.

Used to create concise backtraces that contain the original exception(s) and the most important (=marked) statements of the current call stack.

statementThe statement to mark and execute.
libfsafe::UnexpectedExceptionIf statement throws.
See also:

Definition at line 30 of file checkpoint.hxx.

 All Classes Files Defines