1 #ifndef CGI___CGI_EXCEPTION__HPP
2 #define CGI___CGI_EXCEPTION__HPP
124 return m_StatusMessage.empty() ?
125 GetStdStatusMessage(m_StatusCode) : m_StatusMessage;
128 static string GetStdStatusMessage(EStatusCode
code);
135 const string& message,
173 case eValue:
return "Bad cookie";
174 case eString:
return "Bad cookie string format";
181 std::string::size_type);
212 switch ( GetErrCode() ) {
213 case eCookie:
return "Malformed HTTP Cookie";
214 case eRead:
return "Error in receiving HTTP request";
215 case eIndex:
return "Error in parsing ISINDEX-type CGI arguments";
216 case eEntry:
return "Error in parsing CGI arguments";
217 case eAttribute:
return "Bad part attribute in multipart HTTP request";
218 case eFormat:
return "Misformatted data in HTTP request";
219 case eData:
return "Unexpected or inconsistent HTTP request";
252 std::string::size_type);
273 case eErrno:
return "System error";
274 case eModTime:
return "File system error";
299 switch ( GetErrCode() ) {
300 case eDoubleHeader:
return "Header has already been written";
327 switch ( GetErrCode() ) {
328 case eHeaderSent:
return "Header has been written";
357 switch ( GetErrCode() ) {
358 case eSessionId:
return "SessionId not specified";
359 case eImplNotSet:
return "Session implementation not set";
360 case eDeleted:
return "Session has been deleted";
388 switch (GetErrCode()) {
389 case eApp:
return "CGI application error";
398 #define NCBI_CGI_THROW_WITH_STATUS(exception, err_code, message, status) \
400 NCBI_EXCEPTION_VAR(cgi_exception, exception, err_code, message); \
401 cgi_exception.SetStatus( (status) ); \
402 NCBI_EXCEPTION_THROW(cgi_exception); \
405 #define NCBI_CGI_THROW2_WITH_STATUS(exception, err_code, \
406 message, extra, status) \
408 NCBI_EXCEPTION2_VAR(cgi_exception, exception, \
409 err_code, message, extra); \
410 cgi_exception.SetStatus( (status) ); \
411 NCBI_EXCEPTION_THROW(cgi_exception); \
Incapsulate compile time information such as __FILE__, __LINE__, NCBI_MODULE, current function.
The NCBI C++ standard methods for dealing with std::string.
NCBI_EXCEPTION_DEFAULT(CCgiException, CException)
NCBI_EXCEPTION_DEFAULT(CCgiSessionException, CCgiException)
virtual const char * GetErrCodeString(void) const override
Translate from the error code value to its string representation.
virtual const char * GetErrCodeString(void) const override
virtual const char * GetErrCodeString(void) const override
Translate from the error code value to its string representation.
virtual const char * GetErrCodeString(void) const override
virtual const char * GetErrCodeString(void) const override
EStatusCode GetStatusCode(void) const
NCBI_EXCEPTION_DEFAULT2(CCgiCookieException, CParseTemplException< CCgiException >, std::string::size_type)
CUrlException CCgiArgsException
virtual const char * GetErrCodeString(void) const override
EErrCode
Bad (malformed or missing) HTTP request components.
NCBI_EXCEPTION_DEFAULT(CCgiAppException, CCgiException)
CCgiException & SetStatus(const SCgiStatus &status)
NCBI_EXCEPTION_DEFAULT(CCgiErrnoException, CErrnoTemplException< CCgiException >)
NCBI_EXCEPTION_DEFAULT(CCgiHeadException, CCgiException)
virtual const char * GetErrCodeString(void) const override
NCBI_EXCEPTION_DEFAULT(CCgiResponseException, CCgiException)
SCgiStatus(CCgiException::EStatusCode code, const string &message=kEmptyStr)
CCgiException::EStatusCode m_Code
NCBI_EXCEPTION_DEFAULT2(CCgiParseException, CParseTemplException< CCgiRequestException >, std::string::size_type)
string GetStatusMessage(void) const
CUrlParserException CCgiArgsParserException
NCBI_EXCEPTION_DEFAULT(CCgiRequestException, CCgiException)
EStatusCode
HTTP status codes.
@ eHeaderSent
Header has been written.
@ eSessionId
SessionId not specified.
@ eSessionDoesnotExist
Session does not exist.
@ eDeleted
Session has been deleted.
@ eAttrNotFound
Attribute not found.
@ eImplNotSet
Session implementation not set.
@ eImplException
Implementation exception.
@ eNotLoaded
Session not loaded.
@ eDoubleHeader
Header has already been written.
@ eBadHeaderValue
Invalid header value.
EDiagSev
Severity level for the posted diagnostics.
@ e413_RequestEntityTooLarge
@ e412_PreconditionFailed
@ e422_UnprocessableEntity
@ e101_SwitchingProtocols
@ e503_ServiceUnavailable
@ e451_Unavailable_For_Legal_Reasons
@ e505_HTTPVerNotSupported
@ e416_RangeNotSatisfiable
@ e203_NonAuthInformation
@ e500_InternalServerError
@ e415_UnsupportedMediaType
virtual void x_Init(const CDiagCompileInfo &info, const string &message, const CException *prev_exception, EDiagSev severity)
Helper method for initializing exception data.
TErrCode GetErrCode(void) const
virtual void x_Assign(const CException &src)
Helper method for copying exception data.
virtual const char * GetErrCodeString(void) const
Get error code interpreted as text.
#define EXCEPTION_VIRTUAL_BASE
Do not use virtual base classes in exception declaration at all, because in this case derived class s...
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
TErrCode GetErrCode(void) const
Get error code.
Defines NCBI C++ exception handling.
Defines CRequestStatus class for NCBI C++ diagnostic API.