BasicException Class Reference
BasicException is a general purpose exception class.
More...
#include <BasicException.h>
Collaboration diagram for BasicException:
[legend]List of all members.
Detailed Description
BasicException is a general purpose exception class.
It is similar to the java Exception class. A BasicException can carry a message, a BasicFileLocation and/or a pointer to an exception which was the original cause.
There are preprocessor macros that can be used to as a convient way to add the current file, line and column where the exception occured. These are:
THROW(const string message)
and
ASSERT_OR_THROW(const string message, const bool condition)
The latter can be used to in place of assert(const bool condition). Throwing an exception instead of aborting overcomes some of the limitations of the standard assert.
Constructor & Destructor Documentation
BasicException::BasicException |
( |
|
) |
[inline] |
|
BasicException::BasicException |
( |
const std::string |
message |
) |
[inline] |
|
BasicException::BasicException |
( |
const std::string |
message, |
|
|
const BasicFileLocation & |
location |
|
) |
[inline] |
|
BasicException::BasicException |
( |
const std::string |
message, |
|
|
BasicException & |
cause |
|
) |
[inline] |
|
Member Function Documentation
BasicSmartPointer<BasicException> BasicException::getCause |
( |
|
) |
const [inline] |
|
|
- Returns:
- A BasicSmartPointer to the BasicException that caused this exception or NULL.
|
const std::string BasicException::getMessage |
( |
|
) |
const [inline] |
|
BasicSmartPointer<std::list<std::string> > BasicException::getTrace |
( |
|
) |
const [inline] |
|
void BasicException::init |
( |
|
) |
[inline, protected] |
|
std::ostream& BasicException::print |
( |
std::ostream & |
stream, |
|
|
bool |
printLocations = true , |
|
|
unsigned int |
printLevel = 0 |
|
) |
const [inline] |
|
|
Prints the complete exception recuring down to the cause exception if not null.
WARNING: If there are many layers of causes this function could print a very large amount of data. This can be limited by setting the causePrintLevel variable.
- Parameters:
-
| stream | The output stream. |
| printLocations | Print file locations. |
| printLevel | The current cause print level. |
- Returns:
- A reference to the passed stream.
|
Friends And Related Function Documentation
std::ostream& operator<< |
( |
std::ostream & |
stream, |
|
|
const BasicException & |
e |
|
) |
[friend] |
|
|
An stream output operator for BasicException.
This allows you to print the text of an exception to a stream like so:
. . . } catch (BasicException &e) { cout << e << endl; return 0; } |
Member Data Documentation
The documentation for this class was generated from the following files:
Generated on Thu Sep 16 16:17:23 2004 for nostdinc by
1.3.8