24 #if ! defined(__PLUMED_EXCEPTIONS)
34 std::string Exception::format(
const std::string&msg,
const std::string&file,
unsigned line,
const std::string&
function){
36 message=
"\n+++ Internal PLUMED error";
39 sprintf(cline,
"%u",line);
40 message +=
"\n+++ file "+file+
", line "+cline;
41 if(
function.length()>0) message +=
", function "+
function;
43 if(msg.length()>0) message +=
"\n+++ message: "+msg;
48 Exception::Exception():
49 msg(format(
"",
"",0,
""))
55 msg(format(msg,
"",0,
""))
60 Exception::Exception(
const std::string&msg,
const std::string&file,
unsigned line,
const std::string&
function):
61 msg(format(msg,file,line,function))
67 #if ! defined(__PLUMED_EXCEPTIONS)
68 fprintf(stderr,
"%s",
what());
72 int i, frames = backtrace(callstack, 128);
73 char** strs = backtrace_symbols(callstack, frames);
74 for (i = 0; i < frames; ++i) {
75 fprintf(stderr,
"%s\n", strs[i]);
Exception()
Without message.
void abortIfExceptionsAreDisabled()
Method which aborts in case exceptions are disabled.
virtual const char * what() const
Returns the error message.