base class corresponding to errors that will be thrown by fastjet More...
#include <Error.hh>
Public Member Functions | |
Error () | |
default constructors | |
Error (const std::string &message) | |
ctor from an error message | |
virtual | ~Error () |
virtual dummy dtor | |
std::string | message () const |
the error ,essage | |
Static Public Member Functions | |
static void | set_print_errors (bool print_errors) |
controls whether the error message (and the backtrace) is printed out or not | |
static void | set_backtrace (bool enabled) |
controls whether the error message (and the backtrace) is printed out or not |
base class corresponding to errors that will be thrown by fastjet
Definition at line 45 of file Error.hh.
fastjet::Error::Error | ( | const std::string & | message | ) |
ctor from an error message
message | to be printed Note: by default, in addition to the error message, the backtrace will be displayed (showing the last few calls before the error) |
Definition at line 48 of file Error.cc.
{ _message = message; if (_print_errors){ ostringstream oss; oss << "fastjet::Error: "<< message << endl; // only print the stack if execinfo is available and stack enabled #ifdef FASTJET_HAVE_EXECINFO_H if (_print_backtrace){ void * array[10]; char ** messages; int size = backtrace(array, 10); messages = backtrace_symbols(array, size); oss << "stack:" << endl; for (int i = 1; i < size && messages != NULL; ++i){ oss << " #" << i << ": " << messages[i] << endl; } free(messages); } #endif std::cerr << oss.str(); } }