BESDapError Class Reference

error object created from libdap error objects and can handle those errors More...

#include <BESDapError.h>

Inheritance diagram for BESDapError:

Inheritance graph
[legend]
Collaboration diagram for BESDapError:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 BESDapError (const string &s, bool fatal, ErrorCode ec, const string &file, int line)
virtual ~BESDapError ()
int get_error_code ()
virtual void set_message (const string &msg)
 set the error message for this exception
virtual string get_message ()
 get the error message for this exception
virtual string get_file ()
 get the file name where the exception was thrown
virtual int get_line ()
 get the line number where the exception was thrown
virtual void set_error_type (int type)
 Set the return code for this particular error class.
virtual int get_error_type ()
 Return the return code for this error class.
virtual void dump (ostream &strm) const
 Displays debug information about this object.

Static Public Member Functions

static int convert_error_code (int error_code, int current_error_type)
 converts the libdap error code to the bes error type
static int handleException (BESError &e, BESDataHandlerInterface &dhi)
 handles exceptions if the error context is set to dap2

Protected Member Functions

 BESDapError ()

Protected Attributes

string _msg
unsigned int _type
string _file
unsigned int _line

Detailed Description

error object created from libdap error objects and can handle those errors

The BESDapError is an error object that is created from libdap error objects caught during libdap processing.

The exception handling function handleException knows how to convert libdap errors to dap error responses if the context is set to dap2

Definition at line 51 of file BESDapError.h.


Constructor & Destructor Documentation

BESDapError::BESDapError (  )  [inline, protected]

Definition at line 56 of file BESDapError.h.

BESDapError::BESDapError ( const string &  s,
bool  fatal,
ErrorCode  ec,
const string &  file,
int  line 
) [inline]

Definition at line 58 of file BESDapError.h.

References BES_INTERNAL_ERROR, BES_INTERNAL_FATAL_ERROR, and BESError::set_error_type().

Here is the call graph for this function:

virtual BESDapError::~BESDapError (  )  [inline, virtual]

Definition at line 71 of file BESDapError.h.


Member Function Documentation

int BESDapError::get_error_code (  )  [inline]

Definition at line 72 of file BESDapError.h.

Referenced by handleException().

int BESDapError::convert_error_code ( int  error_code,
int  current_error_type 
) [static]

converts the libdap error code to the bes error type

This functions converts the libdap error codes in Error to the proper BES error type.

undefined_error 1000 -> BES_INTERNAL_ERROR unknown_error 1001 -> BES_INTERNAL_ERROR internal_error 1002 -> BES_INTERNAL_FATAL_ERROR no_such_file 1003 -> BES_NOT_FOUND_ERROR no_such_variable 1004 -> BES_SYNTAX_USER_ERROR malformed_expr 1005 -> BES_SYNTAX_USER_ERROR no_authorization 1006 -> BES_FORBIDDEN_ERROR cannot_read_file 1007 -> BES_FORBIDDEN_ERROR dummy_message 1008 -> BES_FORBIDDEN_ERROR

If the error type is already set to BES_INTERNAL_FATAL_ERROR it is not changed.

Parameters:
error_code The libdap error code to convert
current_error_type The current error type of the exception
Returns:
BES error type used in any error response

Definition at line 64 of file BESDapError.cc.

References BES_FORBIDDEN_ERROR, BES_INTERNAL_ERROR, BES_INTERNAL_FATAL_ERROR, BES_NOT_FOUND_ERROR, and BES_SYNTAX_USER_ERROR.

Referenced by handleException().

int BESDapError::handleException ( BESError e,
BESDataHandlerInterface dhi 
) [static]

handles exceptions if the error context is set to dap2

If the error context from the BESContextManager is set to dap2 then handle all exceptions by returning transmitting them as dap2 error messages.

Parameters:
e exception to be handled
dhi structure that holds request and response information

Definition at line 118 of file BESDapError.cc.

References convert_error_code(), _BESDataHandlerInterface::error_info, BESContextManager::get_context(), get_error_code(), BESError::get_error_type(), BESError::get_message(), BESError::set_error_type(), BESError::set_message(), and BESContextManager::TheManager().

Referenced by BESDapModule::initialize().

Here is the call graph for this function:

virtual void BESError::set_message ( const string &  msg  )  [inline, virtual, inherited]

set the error message for this exception

Parameters:
msg message string

Definition at line 83 of file BESError.h.

References BESError::_msg.

Referenced by handleException().

virtual string BESError::get_message (  )  [inline, virtual, inherited]

get the error message for this exception

Returns:
error message

Definition at line 88 of file BESError.h.

References BESError::_msg.

Referenced by BESInfo::add_exception(), BESMemoryGlobalArea::BESMemoryGlobalArea(), PPTClient::closeConnection(), BESApacheInterface::exception_manager(), BESInterface::finish(), handleException(), PPTClient::initConnection(), BESModuleApp::initialize(), BESBaseApp::initialize(), main(), ServerApp::run(), CmdApp::run(), and BESModuleApp::terminate().

virtual string BESError::get_file (  )  [inline, virtual, inherited]

get the file name where the exception was thrown

Returns:
file name

Definition at line 93 of file BESError.h.

References BESError::_file.

Referenced by BESInfo::add_exception().

virtual int BESError::get_line (  )  [inline, virtual, inherited]

get the line number where the exception was thrown

Returns:
line number

Definition at line 98 of file BESError.h.

References BESError::_line.

Referenced by BESInfo::add_exception().

virtual void BESError::set_error_type ( int  type  )  [inline, virtual, inherited]

Set the return code for this particular error class.

Sets the return code for this error class, which could represent the need to terminate or do something specific based on the error.

Parameters:
return_code code used when returning from the error

Definition at line 106 of file BESError.h.

References BESError::_type.

Referenced by BESDapError(), handleException(), and BESApacheInterface::validate_data_request().

virtual int BESError::get_error_type (  )  [inline, virtual, inherited]

Return the return code for this error class.

Returns the return code for this error class, which could represent the need to terminate or do something specific base on the error

Returns:
context string

Definition at line 114 of file BESError.h.

References BESError::_type.

Referenced by BESInfo::add_exception(), BESApacheInterface::exception_manager(), BESExceptionManager::handle_exception(), and handleException().

void BESError::dump ( ostream &  strm  )  const [virtual, inherited]

Displays debug information about this object.

Parameters:
strm output stream to use to dump the contents of this object

Implements BESObj.

Reimplemented in BESForbiddenError, BESInternalError, BESInternalFatalError, BESNotFoundError, and BESSyntaxUserError.

Definition at line 44 of file BESError.cc.

References BESError::_file, BESError::_line, BESError::_msg, BESError::_type, BESIndent::Indent(), BESIndent::LMarg(), and BESIndent::UnIndent().

Referenced by BESSyntaxUserError::dump(), BESNotFoundError::dump(), BESInternalFatalError::dump(), BESInternalError::dump(), and BESForbiddenError::dump().

Here is the call graph for this function:


Member Data Documentation

string BESError::_msg [protected, inherited]

Definition at line 54 of file BESError.h.

Referenced by BESError::BESError(), BESError::dump(), BESError::get_message(), and BESError::set_message().

unsigned int BESError::_type [protected, inherited]

Definition at line 55 of file BESError.h.

Referenced by BESError::dump(), BESError::get_error_type(), and BESError::set_error_type().

string BESError::_file [protected, inherited]

Definition at line 56 of file BESError.h.

Referenced by BESError::dump(), and BESError::get_file().

unsigned int BESError::_line [protected, inherited]

Definition at line 57 of file BESError.h.

Referenced by BESError::dump(), and BESError::get_line().


The documentation for this class was generated from the following files:
Generated on Tue Mar 4 23:18:43 2008 for OPeNDAP Back End Server (BES) by  doxygen 1.5.1