bes  Updated for version 3.19.1
BESExceptionManager Class Reference

manages exception handling code and default exceptions More...

#include <BESExceptionManager.h>

Inheritance diagram for BESExceptionManager:
Inheritance graph

Public Member Functions

virtual void add_ehm_callback (p_bes_ehm ehm)
 Register an exception handler with the manager. More...
 
virtual void dump (ostream &strm) const
 dumps information about this object More...
 
virtual int handle_exception (BESError &e, BESDataHandlerInterface &dhi)
 Manage any exceptions thrown during the handling of a request. More...
 

Static Public Member Functions

static BESExceptionManagerTheEHM ()
 

Detailed Description

manages exception handling code and default exceptions

The BESExceptionManager, a singleton, manages exceptions that are thrown during the handling of a request. Exceptions are handled by creating error informational objects and/or handling the exception and continuing.

If an error informational object is created then assign the new informational object to BESDataHandlerInterface.error_info variable.

No error information should be transmitted during the handling of the exception as we give the server code a chance to react to an exception before the exception information is sent.

The exception information is sent during the transmit of a response. An exception is handled just like any other response in terms of being transmitted.

Modules have a chance of registering exception handlers to the manager to be able to handle exceptions differently, or handle specific exceptions in a specific way. Exception handling functions are registered with the following signature:

int function_name( BESError &e, BESDataHandlerInterface &dhi ) ;

If the registered functioon does not handle the exception then the function should return BES_EXECUTED_OK0. If it does handle the exception, return a status code representative of the exception. Currently registered status returns can be found in BESError.h

If no handler can handle the exception then the default is to create a BESInfo object with the given exception.

See also
BESError

Definition at line 84 of file BESExceptionManager.h.

Member Function Documentation

◆ add_ehm_callback()

void BESExceptionManager::add_ehm_callback ( p_bes_ehm  ehm)
virtual

Register an exception handler with the manager.

Signature of the function is as follows:

int function_name( BESError &e, BESDataHandlerInterface &dhi ) ;

If the handler does not handle the exception then it should return 0. Otherwise, return a status code. Pre-defined status codes can be found in BESError.h

Parameters
ehmexception handler function
See also
BESError

Definition at line 69 of file BESExceptionManager.cc.

◆ dump()

void BESExceptionManager::dump ( ostream &  strm) const
virtual

dumps information about this object

Displays the pointer value of this instance along with the number of registered exception handler callbacks. Currently there is no way of telling what callbacks are registered, as no names are passed to the add method.

Parameters
strmC++ i/o stream to dump the information to

Implements BESObj.

Definition at line 217 of file BESExceptionManager.cc.

◆ handle_exception()

int BESExceptionManager::handle_exception ( BESError e,
BESDataHandlerInterface dhi 
)
virtual

Manage any exceptions thrown during the handling of a request.

An informational object should be created and assigned to BESDataHandlerInterface.error_info variable.

The manager first determines if a registered exception handler can handle the exception. First one to handle the exception wins. 0 is returned from the registered handler if it cannot handle the exception.

If no registered handlers can handle the exception then the default is to create an informational object (BESInfo instance) and the exception information stored there.

Parameters
eexception to be managed
dhiinformation related to request and response
Returns
status after exception is handled
See also
BESError
BESInfo

Definition at line 168 of file BESExceptionManager.cc.


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