Simpatico
v1.10
|
A user-defined exception.
Exceptions are usually thrown using the UTIL_THROW() macro.
Definition at line 24 of file Exception.h.
#include <Exception.h>
Public Member Functions | |
Exception (const char *function, const char *message, const char *file, int line, int echo=1) | |
Constructor. More... | |
Exception (const char *message, const char *file, int line, int echo=1) | |
Constructor without function name parameter. More... | |
virtual | ~Exception () |
Destructor. More... | |
void | write (std::ostream &out) |
Write error message to output stream. More... | |
std::string & | message () |
Return the error message. More... | |
Protected Attributes | |
std::string | message_ |
Error message string. More... | |
Util::Exception::Exception | ( | const char * | function, |
const char * | message, | ||
const char * | file, | ||
int | line, | ||
int | echo = 1 |
||
) |
Constructor.
Constructs error message that includes file and line number. Values of the file and line parameters should be given by the built-in macros FILE and LINE, respectively, in the calling function. A typical call of the constructor is thus of the form:
function | name of the function from which the Exception was thrown |
message | message describing the nature of the error |
file | name of the file from which the Exception was thrown |
line | line number in file |
echo | if echo, then echo to Log::file() when constructed. |
Definition at line 22 of file Exception.cpp.
References Util::Log::file(), message_, and write().
Util::Exception::Exception | ( | const char * | message, |
const char * | file, | ||
int | line, | ||
int | echo = 1 |
||
) |
Constructor without function name parameter.
message | message describing the nature of the error |
file | name of the file from which the Exception was thrown |
line | line number in file |
echo | if echo, then echo to std out when constructed. |
Definition at line 48 of file Exception.cpp.
References Util::Log::file(), message_, and write().
|
virtual |
Destructor.
Definition at line 71 of file Exception.cpp.
void Util::Exception::write | ( | std::ostream & | out | ) |
Write error message to output stream.
out | output stream |
Definition at line 77 of file Exception.cpp.
References message_.
Referenced by Exception().
std::string & Util::Exception::message | ( | ) |
Return the error message.
Definition at line 83 of file Exception.cpp.
References message_.
Referenced by Util::MpiThrow().
|
protected |
Error message string.
Definition at line 80 of file Exception.h.
Referenced by Exception(), message(), and write().