35 using std::istringstream;
37 #include "BESShowErrorResponseHandler.h" 38 #include "BESDataNames.h" 39 #include "BESInternalError.h" 40 #include "BESInternalFatalError.h" 41 #include "BESSyntaxUserError.h" 42 #include "BESForbiddenError.h" 43 #include "BESNotFoundError.h" 45 BESShowErrorResponseHandler::BESShowErrorResponseHandler(
const string &name) :
50 BESShowErrorResponseHandler::~BESShowErrorResponseHandler()
70 string etype_s = dhi.
data[SHOW_ERROR_TYPE];
71 if (etype_s.empty()) {
72 string err = dhi.
action +
" error type missing";
75 istringstream strm(etype_s);
76 unsigned int etype = 0;
78 if (!etype || etype > 5) {
79 string err = dhi.
action +
" invalid error type, should be 1-5";
84 case BES_INTERNAL_ERROR: {
85 string err = dhi.
action +
" Internal Error";
88 case BES_INTERNAL_FATAL_ERROR: {
89 string err = dhi.
action +
" Internal Fatal Error";
92 case BES_SYNTAX_USER_ERROR: {
93 string err = dhi.
action +
" Syntax User Error";
96 case BES_FORBIDDEN_ERROR: {
97 string err = dhi.
action +
" Forbidden Error";
100 case BES_NOT_FOUND_ERROR: {
101 string err = dhi.
action +
" Not Found Error";
121 string err =
"An exception should have been thrown, nothing to transmit";
133 strm << BESIndent::LMarg <<
"BESShowErrorResponseHandler::dump - (" << (
void *)
this <<
")" << endl;
136 BESIndent::UnIndent();
140 BESShowErrorResponseHandler::ResponseBuilder(
const string &name)
error thrown if the resource requested cannot be found
exception thrown if an internal error is found and is fatal to the BES
exception thrown if inernal error encountered
response handler that throws the requested exception type
error thrown if there is a user syntax error in the request or any other user error
handler object that knows how to create a specific response object
error thrown if the BES is not allowed to access the resource requested
Structure storing information used by the BES to handle the request.
map< string, string > data
the map of string data that will be required for the current request.
virtual void dump(ostream &strm) const
dumps information about this object
virtual void execute(BESDataHandlerInterface &dhi)
throws a specific exception to test error handling in clients
virtual void dump(ostream &strm) const
dumps information about this object
string action
the response object requested, e.g. das, dds
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)
transmit the response object built by the execute command using the specified transmitter object