26 #include <core/exception.h> 34 class ExampleSmallException :
public Exception 37 ExampleSmallException() :
Exception(
"Small Exception") {}
40 class ExampleBigException :
public Exception 43 ExampleBigException() :
Exception(
"Big Exception") {}
46 class ExampleUnhandledException :
public Exception 49 ExampleUnhandledException() :
Exception(
"Exception not handled") {}
54 throw_some_exception()
57 if ( r < (RAND_MAX / 2)) {
58 throw ExampleSmallException();
59 }
else if ( r > (RAND_MAX - RAND_MAX / 20)) {
63 throw ExampleBigException();
68 indirect_throw_some_exception()
71 throw_some_exception();
79 variadic_func(
const char *format, ...)
91 main(
int argc,
char **argv)
103 indirect_throw_some_exception();
104 }
catch (ExampleSmallException &se) {
105 std::cout <<
"Message: " << se.what() << std::endl;
106 std::cout <<
"Trace:" << std::endl;
108 }
catch (ExampleBigException &be) {
109 std::cout <<
"Message: " << be.what() << std::endl;
110 std::cout <<
"Trace:" << std::endl;
Fawkes library namespace.
Base class for exceptions in Fawkes.
void append(const char *format,...)
Append messages to the message list.