Concrete template
class
which implements Exception's pure virtual methods.
More...
#include <keyvalue/sys/exception/Exception.h>
Public Member Functions | |
const Message & | getMessage () const |
Gets the inner Message. | |
const char * | what () const throw () |
Gets a C string describing the exception. | |
template<typename DataType > | |
ExceptionImpl & | operator& (const DataType &data) |
Appends formated data to a given exception. | |
Private Attributes | |
MessageType | message_ |
string | str_ |
Concrete template
class
which implements Exception's pure virtual methods.
StdExcept | : (template parameter) Standard exception class that this class derives from (either std::runtime_error or std::logic_error ); | |
MessageType | : (template parameter) Type of inner Message object that might be gotten by getMessage(). |
const char * what | ( | ) | const throw () [virtual] |
Gets a C string describing the exception.
Implements Exception.
ExceptionImpl< StdExcept, MessageType > & operator& | ( | const DataType & | data | ) |
Appends formated data to a given exception.
Recall that this class
has a Message member. This method appends data to that member (see Message::operator&).
The typical use for this method is as follows:
if (price <= 0.0)
throw RuntimeError() & "Invalid price. Expecting a positive number. Got " & price;
DataType | : (template parameter) The type of data to be appended. This parameter is automatically deduced by the compiler and may be ignored by the user. | |
exception | : The exception that data should be appended to; | |
data | : The data to be appended. |