#include <exception.hpp>
Public Types | |
enum | ExceptionCodes { ERR_NO_TYPE = 0, ERR_FILE_NOT_FOUND, ERR_CANNOT_WRITE_TO_FILE, ERR_INVALID_PARAMS_CONTENTS, ERR_INVALID_PARAMS_TYPE, ERR_ITEM_ALREADY_EXISTS, ERR_ITEM_NOT_FOUND, ERR_INTERNAL_ERROR, ERR_PROGRAMMING_ERROR, ERR_BADALLOC, ERR_INVALID_STATE, ERR_MATH } |
Public Member Functions | |
void | addMessage (const std::string &m, const std::string &source, const std::string &file, long line) |
... adds a (formatted) string to the existing stack of error messages in the calling hierarchy | |
void | addMessage (const std::string &m) |
... adds a string to the existing stack of error messages in the calling hierarchy | |
Exception (const std::string &m, const std::string &source, const std::string &type, const std::string &file, long line) | |
... constructor, creates the exception with formatted message | |
Exception (const std::string &m) | |
... default constructor, creates the exception with given message | |
virtual std::string | getFormattedString (const std::string &m, const std::string &source, const std::string &type, const std::string &file, const long &line) |
... formats the given exception message and returns the formatted string. | |
virtual const char * | what () const throw () |
... returns exception message | |
virtual | ~Exception () throw () |
... default destructor | |
Static Public Member Functions | |
static Exception | create (int type, const std::string &m, const std::string &source, const std::string &file, long line) |
... creates a (formatted) exception and returns it | |
static const std::string | stringFromDouble (const double &x, const char *format) |
static const std::string | stringFromInt (const int &x) |
static const std::string | stringFromUint (const unsigned int &x) |
Protected Attributes | |
std::string | message |
sfem::Exception::Exception | ( | const std::string & | m | ) | [inline, explicit] |
... default constructor, creates the exception with given message
m | ... is the message |
sfem::Exception::Exception | ( | const std::string & | m, | |
const std::string & | source, | |||
const std::string & | type, | |||
const std::string & | file, | |||
long | line | |||
) | [inline, explicit] |
... constructor, creates the exception with formatted message
m | ... is the message | |
source | ... is the function name | |
type | ... is the type of exception | |
file | ... is the source code file name of origin | |
line | ... is the corresponding line number |
void sfem::Exception::addMessage | ( | const std::string & | m, | |
const std::string & | source, | |||
const std::string & | file, | |||
long | line | |||
) |
... adds a (formatted) string to the existing stack of error messages in the calling hierarchy
m | ... is the message | |
source | ... is the function name | |
file | ... is the source code file name of origin | |
line | ... is the corresponding line number |
void sfem::Exception::addMessage | ( | const std::string & | m | ) |
... adds a string to the existing stack of error messages in the calling hierarchy
m | ... is the message to be added Use case: try {..} catch(Exception& e) { e.addMessage("additional text"); throw e; } |
static Exception sfem::Exception::create | ( | int | type, | |
const std::string & | m, | |||
const std::string & | source, | |||
const std::string & | file, | |||
long | line | |||
) | [static] |
... creates a (formatted) exception and returns it
m | ... is the message | |
source | ... is the function name | |
type | ... is the type of exception (alphanumeric) | |
file | ... is the source code file name of origin | |
line | ... is the corresponding line number |
virtual std::string sfem::Exception::getFormattedString | ( | const std::string & | m, | |
const std::string & | source, | |||
const std::string & | type, | |||
const std::string & | file, | |||
const long & | line | |||
) | [virtual] |
... formats the given exception message and returns the formatted string.
m | ... is the message | |
source | ... is the function name | |
type | ... is the type of exception | |
file | ... is the source code file name of origin | |
line | ... is the corresponding line number |