SPHinXsys
alpha version
|
A class for basic exception functionality. More...
#include <exception.h>
Inherits exception.
Inherited by SPH::IndexOutOfRange, SPH::InvalidArgument, SPH::InvalidCall, SPH::InvalidTemplateArgument, and SPH::KeyNotFound.
Public Member Functions | |
Exception (const std::string &aMsg="", const std::string &aFile="", int aLine=-1) | |
Default Constructor. More... | |
Exception (const std::string &file, size_t line, const std::string &func) | |
Call this constructor from derived classes to add file, line and function information to the error message. Use this when throwing Derived classes. Use OPENSIM_THROW_<> macros at throw sites. | |
Exception (const std::string &file, size_t line, const std::string &func, const std::string &msg) | |
Use this when you want to throw an Exception and also provide a message. | |
virtual | ~Exception () throw () |
void | setMessage (const std::string &aMsg) |
const char * | getMessage () const |
virtual void | print (std::ostream &aOut) const |
const char * | what () const noexcept override |
Protected Member Functions | |
void | addMessage (const std::string &msg) |
A class for basic exception functionality.
Exception class manages the concatenation of error messages from all the derived classes. When creating new exceptions, remember to call addMessage() as shown above if the exception class does have any error message.
SPH::Exception::Exception | ( | const std::string & | aMsg = "" , |
const std::string & | aFile = "" , |
||
int | aLine = -1 |
||
) |
Default Constructor.
This constructor is for backward compatibility. Use the constructor taking file, line, func.
|
inlinevirtual |
@ brief Destructor.
|
protected |
Add to the error message that will be returned for the exception.