Gromacs
5.1.1
|
#include <gromacs/utility/exceptions.h>
Base class for all exception objects in Gromacs.
Although boost recommends using virtual inheritance in exception hiearchies, it is not used here for two reasons:
Public Member Functions | |
virtual const char * | what () const throw () |
Returns the reason string for the exception. More... | |
virtual int | errorCode () const =0 |
Returns the error code corresponding to the exception type. | |
void | prependContext (const std::string &context) |
Adds context information to this exception. More... | |
Protected Member Functions | |
GromacsException (const ExceptionInitializer &details) | |
Creates an exception object with the provided initializer/reason. More... | |
|
explicitprotected |
Creates an exception object with the provided initializer/reason.
[in] | details | Initializer for the exception. |
std::bad_alloc | if out of memory. |
void gmx::GromacsException::prependContext | ( | const std::string & | context | ) |
Adds context information to this exception.
[in] | context | Context string to add. |
std::bad_alloc | if out of memory. |
Typical use is to add additional information higher up in the call stack using this function in a catch block and the rethrow the exception.
|
virtual |
Returns the reason string for the exception.
The return value is the string that was passed to the constructor.