A fuzzy logic C++ library
Public Member Functions | Private Attributes
slifis::ERROR_HANDLER Class Reference

This class is used to hold information about an error that occurred. It inherits from std::exception. More...

#include <error_handler.hpp>

+ Inheritance diagram for slifis::ERROR_HANDLER:
+ Collaboration diagram for slifis::ERROR_HANDLER:

List of all members.

Public Member Functions

 ERROR_HANDLER (EN_ERRMSG err, const char *func, const char *file, int line, clock_t cl) throw ()
 ~ERROR_HANDLER () throw ()
const char * what () const throw ()

Private Attributes

EN_ERRMSG _err
 Error code.
std::string _msg
 Corresponding text.
std::string _func
std::string _file
int _line
clock_t _clock
 current CPU time

Detailed Description

This class is used to hold information about an error that occurred. It inherits from std::exception.

It follows the classical C++ error scheme: it overloads the 'what' function, so when printed, all the information is available.

For example, to catch all errors, the user code can look like this:

try
{
        ... do something than can throw an error
}
catch( const ERROR_HANDLER& e )
{
        cout << "gotcha ! Error message is " << e.what();
}
Bug:
Error handler is not called properly, it does not call the what() function, investigate this.

Constructor & Destructor Documentation

slifis::ERROR_HANDLER::ERROR_HANDLER ( EN_ERRMSG  err,
const char *  func,
const char *  file,
int  line,
clock_t  cl 
) throw () [inline]

Member Function Documentation

const char* slifis::ERROR_HANDLER::what ( ) const throw () [inline]

Member Data Documentation

Error code.

Referenced by what().

std::string slifis::ERROR_HANDLER::_msg [private]

Corresponding text.

std::string slifis::ERROR_HANDLER::_func [private]

Referenced by what().

std::string slifis::ERROR_HANDLER::_file [private]

Referenced by what().

Referenced by what().

clock_t slifis::ERROR_HANDLER::_clock [private]

current CPU time

Referenced by what().