PSCF v1.1
|
Exception thrown when not-a-number (NaN) is encountered. More...
#include <NanException.h>
Public Member Functions | |
NanException (const char *function, const char *file, int line, int echo=1) | |
Constructor. More... | |
NanException (const char *file, int line, int echo=1) | |
Constructor without function name parameter. More... | |
~NanException () | |
Destructor. More... | |
![]() | |
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... | |
Additional Inherited Members | |
![]() | |
std::string | message_ |
Error message string. More... | |
Exception thrown when not-a-number (NaN) is encountered.
An exception to be thrown when a required numerical parameter has a value of NaN. This may happen, for instance, as a result of dividing by zero. A NanException is used rather than a generic Exception in these instances so that the NanException can be caught by a try-catch block.
A NanException behaves identically to a generic Exception, but with a pre-defined error message rather than a user-specified message. There is no preprocessor macro to throw a NanException, so they must be thrown using the constructor. This will typically assume the following syntax, where values of the file and line parameters are given by the built-in macros FILE and LINE, respectively:
Definition at line 39 of file NanException.h.
Pscf::NanException::NanException | ( | const char * | function, |
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.
function | name of the function from which the Exception was thrown |
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 19 of file NanException.cpp.
Pscf::NanException::NanException | ( | const char * | file, |
int | line, | ||
int | echo = 1 |
||
) |
Constructor without function name parameter.
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 28 of file NanException.cpp.
Pscf::NanException::~NanException | ( | ) |
Destructor.
Definition at line 36 of file NanException.cpp.