113 lines
2.9 KiB
C++
113 lines
2.9 KiB
C++
|
|
// -*- C++ -*-
|
|
|
|
|
|
namespace Hurricane {
|
|
|
|
/*! \class Error
|
|
* \brief Error description (\b API)
|
|
*
|
|
*
|
|
* \section secErrorPrintingFormat Printing format
|
|
*
|
|
* Errors are printed with different formats wether the
|
|
* error code is null or not : text: So the following code :
|
|
\code
|
|
try {
|
|
throw Error("Something strange");
|
|
}
|
|
catch {Exception& exception) {
|
|
cerr << exception.what() << endl;
|
|
}
|
|
\endcode
|
|
* Will produce the message :
|
|
\code
|
|
[ERROR] Something strange
|
|
\endcode
|
|
* while the following code :
|
|
\code
|
|
try {
|
|
throw Error(3, "Can't create Net : null cell");
|
|
}
|
|
catch {Exception& exception) {
|
|
cerr << exception.what() << endl;
|
|
}
|
|
\endcode
|
|
* Will produce the message :
|
|
\code
|
|
[ERROR:3] Can't create Net : null cell
|
|
\endcode
|
|
* You can always print something different as shown in
|
|
* the following code :
|
|
\code
|
|
try {
|
|
throw Error(3, "Can't create Net : null cell");
|
|
}
|
|
catch {Error& error) {
|
|
cerr << error.getReason() << " (code " << error.getCode() << ")" << endl;
|
|
}
|
|
catch {Exception& exception) {
|
|
cerr << exception.what() << endl;
|
|
}
|
|
\endcode
|
|
* Which will produce the message :
|
|
\code
|
|
Can't create Net : null cell (code 3)
|
|
\endcode
|
|
*/
|
|
|
|
|
|
/*! \typedef Error::Inherit
|
|
* Useful for calling the base class methods without knowing
|
|
* this class.
|
|
*/
|
|
|
|
|
|
/*! \function Error::Error(const Error& error);
|
|
* Copy constructor.
|
|
*/
|
|
|
|
/*! \function Error::Error(const string& reason);
|
|
* Builds a error characterized by a reason (code defaults to zero).
|
|
*/
|
|
|
|
/*! \function Error::Error(const char* format, ...);
|
|
* Builds a error characterized by a reason, using the \c vararg protocol
|
|
* and \c printf format (code defaults to zero).
|
|
*/
|
|
|
|
/*! \function Error::Error(int code, const string& reason);
|
|
* Builds a error characterized by a reason and a code useful
|
|
* within a switch.
|
|
*/
|
|
|
|
/*! \function Error::Error(int code, const char* format, ...);
|
|
* Builds a error characterized by a reason and a code useful
|
|
* within a switch. The reason is supplied in a \c printf
|
|
* like fashion.
|
|
*/
|
|
|
|
|
|
/*! \function Error& Error::operator=(const Error& error);
|
|
* Assignment operator.
|
|
*/
|
|
|
|
|
|
/*! \function string Error::getReason() const;
|
|
* \Return the reason for which the error was thrown.
|
|
*/
|
|
|
|
/*! \function int Error::getCode() const;
|
|
* \Return the error code number.
|
|
*/
|
|
|
|
/*! \function string Error::textWhere() const;
|
|
* \Return A stack trace, suitable for tty.
|
|
*/
|
|
|
|
/*! \function string Error::htmlWhere() const;
|
|
* \Return A stack trace, suitable for HTML.
|
|
*/
|
|
|
|
}
|