1 #ifndef SCD_EXCEPTION_H
2 #define SCD_EXCEPTION_H
10 * Maximum level of stacktrace.
12 const int SCD_EX_TRACES = 15;
16 * General exeption. Can give a stack trace and generates error messages
19 class scd_exception : public std::exception
23 * Constructor to create an exception with a string as cause.
26 scd_exception(const std::string& msg);
29 * Constroctor to create an exception with a string and an error
30 * message generated from an error number (errno) as cause.
31 * \param the cause prefix
32 * \param the error number to generate the error message for
34 scd_exception(const std::string& msg, int errn);
36 virtual ~scd_exception() throw() {}
39 * Returns a C-String showing the cause of the exception.
41 virtual const char* what() throw();
44 * Returns a C-String showing the stack trace. For name resolution
45 * -rdynamic has to be used while compiling.
47 const char* stacktrace();
51 std::string _backtrace;
53 void _get_backtrace();