BESExceptionManager Class Reference

manages exception handling code and default exceptions More...

#include <BESExceptionManager.h>

Inheritance diagram for BESExceptionManager:

Inheritance graph
[legend]
Collaboration diagram for BESExceptionManager:

Collaboration graph
[legend]

List of all members.

Public Member Functions

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

Static Public Member Functions

static BESExceptionManagerTheEHM ()

Protected Member Functions

 BESExceptionManager ()
virtual ~BESExceptionManager ()


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

Constructor & Destructor Documentation

BESExceptionManager::BESExceptionManager (  )  [protected]

Referenced by TheEHM().

BESExceptionManager::~BESExceptionManager (  )  [protected, virtual]


Member Function Documentation

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:
ehm exception handler function
See also:
BESError

Referenced by BESDapModule::initialize().

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:
strm C++ i/o stream to dump the information to

Implements BESObj.

References BESIndent::Indent(), BESIndent::LMarg(), and BESIndent::UnIndent().

Here is the call graph for this function:

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 can NOT 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:
e excption to be managed
dhi information related to request and response
Returns:
status after exception is handled
See also:
BESError

BESInfo

References _BESDataHandlerInterface::action_name, BESInfo::add_exception(), BESInfo::begin_response(), BESInfoList::build_info(), DEFAULT_ADMINISTRATOR, BESInfo::end_response(), _BESDataHandlerInterface::error_info, BESError::get_error_type(), BESKeys::get_key(), TheBESKeys::TheKeys(), and BESInfoList::TheList().

Referenced by BESInterface::exception_manager().

Here is the call graph for this function:

BESExceptionManager * BESExceptionManager::TheEHM (  )  [static]

References BESExceptionManager().

Referenced by BESInterface::exception_manager(), and BESDapModule::initialize().

Here is the call graph for this function:


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

Generated on Wed Mar 4 04:33:30 2009 for OPeNDAP Back End Server (BES) by  doxygen 1.5.8