26#include <core/exception.h>
34class ExampleSmallException :
public Exception
37 ExampleSmallException() :
Exception(
"Small Exception")
42class ExampleBigException :
public Exception
45 ExampleBigException() :
Exception(
"Big Exception")
50class ExampleUnhandledException :
public Exception
53 ExampleUnhandledException() :
Exception(
"Exception not handled")
62 if (r < (RAND_MAX / 2)) {
63 throw ExampleSmallException();
64 }
else if (r > (RAND_MAX - RAND_MAX / 20)) {
68 throw ExampleBigException();
73indirect_throw_some_exception()
76 throw_some_exception();
84variadic_func(
const char *format, ...)
96main(
int argc,
char **argv)
108 indirect_throw_some_exception();
109 }
catch (ExampleSmallException &se) {
110 std::cout <<
"Message: " << se.what() << std::endl;
111 std::cout <<
"Trace:" << std::endl;
113 }
catch (ExampleBigException &be) {
114 std::cout <<
"Message: " << be.what() << std::endl;
115 std::cout <<
"Trace:" << std::endl;
Base class for exceptions in Fawkes.
void append(const char *format,...) noexcept
Append messages to the message list.
Fawkes library namespace.