![]() |
Vault
4.1
|
VException is the base class for all exceptions thrown by the Vault. More...
#include <vexception.h>
Public Member Functions | |
VException (bool recordStackTrace=false) | |
Constructs a VException with default error code and empty message. | |
VException (const VException &other, bool recordStackTrace=false) | |
Constructs a copy of another VException. | |
VException (int error, const char *errorMessage, bool recordStackTrace=false) | |
Constructs a VException with error code and static message. | |
VException (int error, const VString &errorString, bool recordStackTrace=false) | |
Constructs a VException with error code and VString message. | |
VException (const char *errorMessage, bool recordStackTrace=false) | |
Constructs a VException with default error code and static message. | |
VException (const VString &errorString, bool recordStackTrace=false) | |
Constructs a VException with default error code and VString message. | |
VException (const VSystemError &error, const VString &errorString, bool recordStackTrace=false) | |
Constructs a VException with system error and VString message. | |
virtual | ~VException () throw () |
Destructor. | |
VException & | operator= (const VException &other) |
Assignment operator. | |
virtual const char * | what () const throw () |
Override of the base class method for extracting the message. | |
int | getError () const |
Returns the exception's error code. | |
const VStringVector & | getStackTrace () const |
Returns a reference to the string vector containing the stack trace, if collected. | |
Static Public Attributes | |
static const int | kGenericError = -1 |
The default error code. |
VException is the base class for all exceptions thrown by the Vault.
A VException contains an error code integer and an error message strings. Both are optional.
If you need throw an exception due to an out-of-memory situation, you should only use the VException constructors that take a static message value (const char*). This ensures that you do not cause the VException to allocate yet more memory for the VString that would be created otherwise. VException retains the static message's char pointer and does NOT free or delete it on destruction.
Definition at line 228 of file vexception.h.
VException::VException | ( | bool | recordStackTrace = false | ) |
Constructs a VException with default error code and empty message.
recordStackTrace | if true, will attempt to collect stack trace into mCallStack |
Definition at line 57 of file vexception.cpp.
References ASSERT_INVARIANT.
VException::VException | ( | const VException & | other, |
bool | recordStackTrace = false |
||
) |
Constructs a copy of another VException.
Note that if the mErrorMessage is non-null, both objects will share a (const char*) value, which neither deletes on destruction since it is owned by the caller.
other | the exception to copy |
recordStackTrace | if true, will attempt to collect stack trace into mCallStack |
Definition at line 73 of file vexception.cpp.
References ASSERT_INVARIANT.
VException::VException | ( | int | error, |
const char * | errorMessage, | ||
bool | recordStackTrace = false |
||
) |
Constructs a VException with error code and static message.
error | the error code |
errorMessage | a static error message |
recordStackTrace | if true, will attempt to collect stack trace into mCallStack |
Definition at line 89 of file vexception.cpp.
References ASSERT_INVARIANT.
VException::VException | ( | int | error, |
const VString & | errorString, | ||
bool | recordStackTrace = false |
||
) |
Constructs a VException with error code and VString message.
error | the error code |
errorString | the error message |
recordStackTrace | if true, will attempt to collect stack trace into mCallStack |
Definition at line 105 of file vexception.cpp.
References ASSERT_INVARIANT.
VException::VException | ( | const char * | errorMessage, |
bool | recordStackTrace = false |
||
) |
Constructs a VException with default error code and static message.
errorMessage | a static error message |
recordStackTrace | if true, will attempt to collect stack trace into mCallStack |
Definition at line 121 of file vexception.cpp.
References ASSERT_INVARIANT.
VException::VException | ( | const VString & | errorString, |
bool | recordStackTrace = false |
||
) |
Constructs a VException with default error code and VString message.
errorString | the error message |
recordStackTrace | if true, will attempt to collect stack trace into mCallStack |
Definition at line 137 of file vexception.cpp.
References ASSERT_INVARIANT.
VException::VException | ( | const VSystemError & | error, |
const VString & | errorString, | ||
bool | recordStackTrace = false |
||
) |
Constructs a VException with system error and VString message.
The internal error message will be formatted from the two.
error | the error construct |
errorString | the error message |
recordStackTrace | if true, will attempt to collect stack trace into mCallStack |
Definition at line 153 of file vexception.cpp.
References ASSERT_INVARIANT.
VException::~VException | ( | ) | throw () [virtual] |
Destructor.
The throw() declaration is required to satisfy the base class std::exception definition.
Definition at line 169 of file vexception.cpp.
References NULL.
VException & VException::operator= | ( | const VException & | other | ) |
Assignment operator.
Note that if the mErrorMessage is non-null, both objects will share a (const char*) value, which neither deletes on destruction since it is owned by the caller.
other | the exception to copy |
Definition at line 174 of file vexception.cpp.
References ASSERT_INVARIANT, and getError().
const char * VException::what | ( | ) | const throw () [virtual] |
Override of the base class method for extracting the message.
The throw() declaration is required to satisfy the base class std::exception definition.
Definition at line 187 of file vexception.cpp.
References ASSERT_INVARIANT, and NULL.
int VException::getError | ( | ) | const |
Returns the exception's error code.
Definition at line 196 of file vexception.cpp.
References ASSERT_INVARIANT.
const VStringVector & VException::getStackTrace | ( | ) | const |
Returns a reference to the string vector containing the stack trace, if collected.
The vector will be empty if no stack trace was collected. The reference is invalid when the exception is destructed.
Definition at line 202 of file vexception.cpp.
References ASSERT_INVARIANT.