Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
ErrorHandler Class Reference

#include <elm/util/ErrorHandler.h>

+ Inheritance diagram for ErrorHandler:

Public Member Functions

virtual void onError (error_level_t level, const string &message)
 
virtual ~ErrorHandler ()
 

Static Public Member Functions

static cstring getLevelString (error_level_t level)
 

Static Public Attributes

static ErrorHandler DEFAULT
 
static ErrorHandlerNO_INFO = NO_INFO_HANDLER
 
static ErrorHandlerQUIET = QUIET_HANDLER
 

Detailed Description

An error handler allows to get control on the production of error message. The onError() methods must be overload by subclassing this class and the obtained object must be passed to the ErrorBase that generates the error messages.

Author
H. Cassé casse.nosp@m.@iri.nosp@m.t.fr

Constructor & Destructor Documentation

◆ ~ErrorHandler()

virtual ~ErrorHandler ( )
inlinevirtual

Member Function Documentation

◆ getLevelString()

cstring getLevelString ( error_level_t  level)
static

Get a string representing the supplied error level.

Parameters
levelError level to get string of.
Returns
Matching string.

Referenced by ErrorHandler::onError().

◆ onError()

void onError ( error_level_t  level,
const string message 
)
virtual

This method is called each time an error message is generated. As a default, it display the error on standard error output.

Parameters
levelLevel of the error.
messageMessage to display.

This method may be called by the class inheriting from ErrorHandler . This event will be transmitted to the error handler. to generate an error event.

Parameters
levelLevel of the error event.
messageMessage of the error event.

Reimplemented in QuietHandler, and NoInfoHandler.

References elm::cerr, elm::io::endl, and ErrorHandler::getLevelString().

Referenced by ErrorBase::onError(), and NoInfoHandler::onError().

Member Data Documentation

◆ DEFAULT

ErrorHandler DEFAULT
static

Default error handler that displays to standard error output the messages it gets.

◆ NO_INFO

ErrorHandler & NO_INFO = NO_INFO_HANDLER
static

Error handler that displays all except the information messages.

◆ QUIET

ErrorHandler & QUIET = QUIET_HANDLER
static

Error handler that does not display anything.


The documentation for this class was generated from the following files: