Switched from autotools to CMake.
[libsex.git] / source / throw.hxx
bloba9b6511a30d6def62d7835c7f7c5a5f8267222a2
1 #ifndef LIBSEX_THROW_HXX
2 #define LIBSEX_THROW_HXX
4 #include <source/utility.hxx>
6 /**
7 * Macro to throw an exception.
9 * File name and line number are inserted automatically.
11 * @param class Which exception to throw.
12 * @param args... Optional. Arguments for message template.
14 #define THROW(class, args...) \
15 { \
16 throw libsex::formatted<class>(__FILE__, __LINE__, ##args); \
19 /**
20 * Macro to throw another exception when an exception has
21 * been caught.
23 * Chains the previous exception and the newly created one
24 * together.
26 * @note The previous exception has to be accessible in
27 * this scope via the variable name @c e.
29 * @see THROW
31 #define CHAIN(class, args...) \
33 throw libsex::formatted<class>(e, __FILE__, __LINE__, ##args); \
36 #endif