1 #ifndef LIBSEX_THROW_HXX
2 #define LIBSEX_THROW_HXX
4 #include <source/utility.hxx>
7 * Macro to throw an exception without any argument.
9 * File name and line number are inserted automatically.
11 * @param class Which exception to throw.
13 #define THROW_ARGLESS(class) \
15 throw libsex::formatted<class>(__FILE__, __LINE__); \
19 * Macro to throw an exception with arguments.
21 * @see THROW_ARGLESS()
22 * @param args... Arguments for message template.
24 #define THROW(class, args...) \
26 throw libsex::formatted<class>(__FILE__, __LINE__, ##args); \
30 * Macro to throw another exception when an exception has
33 * Chains the previous exception and the newly created one
36 * @note The previous exception has to be accessible in
37 * this scope via the variable name @c e.
41 #define CHAIN(class, args...) \
43 throw libsex::formatted<class>(e, __FILE__, __LINE__, ##args); \