iError Project Site at SourceForge.net Logo
Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

iERR::iStdErrorHandler Class Reference

The standart error handler. More...

#include <iError.h>

Inheritance diagram for iERR::iStdErrorHandler::

iERR::iErrorHandler List of all members.

Public Methods

 iStdErrorHandler ()
 Default constructor. More...

void ShowDebugInfo (bool)
 default true if _DEBUG is defined. More...

iError::ErrorLevel SetNotificationLevel (iError::ErrorLevel newLevel)
 Set the level, below which no messages are displayed. More...

virtual int Throw (iError::ErrorLevel errLevel, const char *functionName, const char *file, int line, iErrorCode *errCode,...)
 Use this method to create error and evtl to throw it as C++ exception. More...

virtual bool Rethrow (const char *functionName=NULL, const char *file=NULL, int line=0)
 Use this method to propagate the error or use iRethrow macro to call Rethrow of the current error handler. More...

virtual bool Handle (const char *functionName=NULL, const char *file=NULL, int line=0)
 Display the last error occured, write it to a log file or whatever the error handler desires to do with it. More...

virtual bool Reset ()
 Use this method to reset the last error, so iLastError will return NULL. More...

virtual iErrorLastError (bool reset=false)
 Returns the last error occured. More...

iErrorHandlerSetCurrent ()
 Set this error handler to be the current error handler. More...


Static Public Methods

iErrorHandlerCurrent ()
 Get the current error handler. More...


Static Public Attributes

iStdErrorHandler m_Default
 The instance of this used as default error handler. More...


Protected Methods

virtual void _Throw ()
 overload this method to provide customized error throwing. More...

virtual void _Handle ()
 overload this method to provide customized error handling. More...


Protected Attributes

bool m_ShowDebugInfo
iError::ErrorLevel m_NotificationLevel
iErrorm_Last
 @label pointer to m_LastError or NULL. More...


Friends

class iError

Detailed Description

The standart error handler.

The throwing of errors:

The handling of errors: print the description to stderr or display a message box

Definition at line 556 of file iError.h.


Constructor & Destructor Documentation

iERR::iStdErrorHandler::iStdErrorHandler  
 

Default constructor.

Definition at line 305 of file iError.cpp.


Member Function Documentation

void iERR::iStdErrorHandler::_Handle   [protected, virtual]
 

overload this method to provide customized error handling.

Reimplemented from iERR::iErrorHandler.

Definition at line 343 of file iError.cpp.

References iERR::iErrorHandler::m_Last, and m_NotificationLevel.

void iERR::iStdErrorHandler::_Throw   [protected, virtual]
 

overload this method to provide customized error throwing.

Reimplemented from iERR::iErrorHandler.

Definition at line 316 of file iError.cpp.

References iERR::iErrorHandler::Handle(), iERR::iERR_NO_EXCEPTIONS(), iThrow, iERR::iErrorHandler::LastError(), iERR::iErrorHandler::m_Last, iERR::UNKNOWN(), and WARNING.

iErrorHandler * iERR::iErrorHandler::Current   [static, inherited]
 

Get the current error handler.

Definition at line 242 of file iError.cpp.

References iERR::iErrorHandler::iErrorHandler().

bool iERR::iErrorHandler::Handle const char *    functionName = NULL,
const char *    file = NULL,
int    line = 0
[virtual, inherited]
 

Display the last error occured, write it to a log file or whatever the error handler desires to do with it.

If HERE macro is used as parameter, the debug information of the error is replaced with the file name and line number of the caller.

Returns:
true if an error was handled, false if there were no errors to handle.
Parameters:
file  the filename, where the error is handled
line  the line where the error is handled

Definition at line 194 of file iError.cpp.

References iERR::iErrorHandler::_Handle(), and iERR::iErrorHandler::m_Last.

Referenced by _Throw().

iError * iERR::iErrorHandler::LastError bool    reset = false [virtual, inherited]
 

Returns the last error occured.

Parameters:
reset  if true the last error is reset to NULL, if false the subsequent calls to Last() are possible
If an error occurs in a function, that have a return type, the function will throw an iError and return the NULL value. The iError instance is stored internal by iErrorHandler class and may be retrived by the LastError() method. If no error occured, NULL is returned.

Definition at line 233 of file iError.cpp.

References iERR::iErrorHandler::iError, iERR::iErrorHandler::m_Last, and iERR::iErrorHandler::Reset().

Referenced by _Throw().

bool iERR::iErrorHandler::Reset   [virtual, inherited]
 

Use this method to reset the last error, so iLastError will return NULL.

Returns:
true if there were an unhandled error, false if there were no errors.

Definition at line 220 of file iError.cpp.

References iERR::iErrorHandler::m_Last.

Referenced by iERR::iErrorHandler::LastError().

bool iERR::iErrorHandler::Rethrow const char *    functionName = NULL,
const char *    file = NULL,
int    line = 0
[virtual, inherited]
 

Use this method to propagate the error or use iRethrow macro to call Rethrow of the current error handler.

If HERE macro is used as parameter, the debug information of the error is replaced with the file name and line number of the caller.

Returns:
true if an error was rethrown, false if there were no errors.
Parameters:
file  the filename, where the error occured
line  the line where the error occured example: if (iRethrow(HERE)) return;

Definition at line 169 of file iError.cpp.

References iERR::iErrorHandler::_Throw(), and iERR::iErrorHandler::m_Last.

iErrorHandler * iERR::iErrorHandler::SetCurrent   [inherited]
 

Set this error handler to be the current error handler.

Returns:
old error handler.

Definition at line 277 of file iError.cpp.

References iERR::iErrorHandler::iErrorHandler().

iError::ErrorLevel iERR::iStdErrorHandler::SetNotificationLevel iError::ErrorLevel    newLevel
 

Set the level, below which no messages are displayed.

Default level is iINFO. @exaple SetErrorLevel(iCRITICAL) will not display iWARNING and iINFO errors.

Returns:
old

void iERR::iStdErrorHandler::ShowDebugInfo bool   
 

default true if _DEBUG is defined.

int iERR::iErrorHandler::Throw iError::ErrorLevel    errLevel,
const char *    functionName,
const char *    fileName,
int    lineNr,
iErrorCode   errCode,
...   
[virtual, inherited]
 

Use this method to create error and evtl to throw it as C++ exception.

Or use iThrow macro to call Throw of the current error handler. Use INFO, WARNING, CRITICAL or EXCEPTION macros instead of specifying parameters The default error handler will only throw the error as C++ exception if the error level is iEXCEPTION. Use Handle() to display the last error or whatever the error handler will do with it.

Parameters:
errLevel  iINFO, iWARNING, iCRITICAL or iEXCEPTION
file  the filename, where the error occured
line  the line where the error occured
errCode  the type of error
...  the description parameters according to the errCode description
Returns:
the error code as integer as defined by errCode object example: iThrow(WARNING(OBJ_NOT_FOUND), "obj name");

Definition at line 99 of file iError.cpp.

References iERR::iErrorHandler::_Throw(), iERR::iErrorHandler::m_Last, and iERR::iErrorHandler::m_LastError.


Friends And Related Function Documentation

friend class iError [friend, inherited]
 

Definition at line 413 of file iError.h.

Referenced by iERR::iErrorHandler::iErrorHandler(), and iERR::iErrorHandler::LastError().


Member Data Documentation

iStdErrorHandler iERR::iStdErrorHandler::m_Default [static]
 

The instance of this used as default error handler.

Definition at line 44 of file iError.cpp.

iError* iERR::iErrorHandler::m_Last [protected, inherited]
 

@label pointer to m_LastError or NULL.

See also:
LastError()

Definition at line 528 of file iError.h.

Referenced by _Handle(), _Throw(), iERR::iErrorHandler::Handle(), iERR::iErrorHandler::LastError(), iERR::iErrorHandler::Reset(), iERR::iErrorHandler::Rethrow(), and iERR::iErrorHandler::Throw().

iError::ErrorLevel iERR::iStdErrorHandler::m_NotificationLevel [protected]
 

Definition at line 581 of file iError.h.

Referenced by _Handle().

bool iERR::iStdErrorHandler::m_ShowDebugInfo [protected]
 

Definition at line 580 of file iError.h.


The documentation for this class was generated from the following files:
© 2002 by C-LAB
generated by doxygen