22 #ifndef __PLUMED_tools_Exception_h
23 #define __PLUMED_tools_Exception_h
100 static std::string
format(
const std::string&,
const std::string&,
unsigned,
const std::string&);
109 Exception(
const std::string&,
const std::string&,
unsigned,
const std::string&);
111 virtual const char*
what()
const throw(){
return msg.c_str();}
117 #if !defined(__PRETTY_FUNCTION__)
118 #define __PRETTY_FUNCTION__ ""
123 #define plumed_error() throw PLMD::Exception("",__FILE__,__LINE__,__PRETTY_FUNCTION__)
126 #define plumed_merror(msg) throw PLMD::Exception(msg,__FILE__,__LINE__,__PRETTY_FUNCTION__)
129 #define plumed_assert(test) if(!(test)) throw PLMD::Exception("assertion failed " #test,__FILE__,__LINE__,__PRETTY_FUNCTION__)
132 #define plumed_massert(test,msg) if(!(test)) throw PLMD::Exception("assertion failed " #test ", " msg,__FILE__,__LINE__,__PRETTY_FUNCTION__)
135 #define plumed_dbg_assert(test)
136 #define plumed_dbg_massert(test,msg)
140 #define plumed_dbg_assert(test) if(!(test)) throw PLMD::Exception("assertion failed " #test,__FILE__,__LINE__,__PRETTY_FUNCTION__)
143 #define plumed_dbg_massert(test,msg) if(!(test)) throw PLMD::Exception("assertion failed " #test ", " msg,__FILE__,__LINE__,__PRETTY_FUNCTION__)
Exception()
Without message.
void abortIfExceptionsAreDisabled()
Method which aborts in case exceptions are disabled.
Class to deal with Plumed runtime errors.
static std::string format(const std::string &, const std::string &, unsigned, const std::string &)
Common tool, invoked by all the constructor to build the message string.
virtual ~Exception()
Destructor should be defined and should not throw other exceptions.
virtual const char * what() const
Returns the error message.