Commit 2842aef7 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - added possibility to disable the backtrace

parent 18d0e510
......@@ -38,13 +38,22 @@
#include "WException.h"
/**
* initialize static member.
*/
bool WException::noBacktrace=false;
WException::WException( const std::string& msg ): exception()
{
// initialize members
m_msg = msg;
// print stacktrace and message
std::cerr << "Exception thrown! Callstack's backtrace:" << std::endl << getBacktrace() << std::endl;
// no backtrace?
if ( !noBacktrace )
{
std::cerr << "Exception thrown! Callstack's backtrace:" << std::endl << getBacktrace() << std::endl;
}
}
......
......@@ -72,6 +72,15 @@ public:
*/
std::string getBacktrace() const;
/**
* Function disables backtraces. Please note that the backtrace can not be reactivated to avoid people from dis/enabling them
* at will.
*/
static void disableBacktrace()
{
noBacktrace=true;
}
protected:
/**
* Message given during throw.
......@@ -84,6 +93,10 @@ protected:
*/
std::list< std::string > m_trace;
/**
* True if the backtrace should NOT be printed.
*/
static bool noBacktrace;
private:
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment