1 #ifndef CGI___CGI_EXCEPTION__HPP
2 #define CGI___CGI_EXCEPTION__HPP
125 return m_StatusMessage.empty() ?
126 GetStdStatusMessage(m_StatusCode) : m_StatusMessage;
129 static string GetStdStatusMessage(EStatusCode
code);
136 const string& message,
174 case eValue:
return "Bad cookie";
175 case eString:
return "Bad cookie string format";
182 std::string::size_type);
213 switch ( GetErrCode() ) {
214 case eCookie:
return "Malformed HTTP Cookie";
215 case eRead:
return "Error in receiving HTTP request";
216 case eIndex:
return "Error in parsing ISINDEX-type CGI arguments";
217 case eEntry:
return "Error in parsing CGI arguments";
218 case eAttribute:
return "Bad part attribute in multipart HTTP request";
219 case eFormat:
return "Misformatted data in HTTP request";
220 case eData:
return "Unexpected or inconsistent HTTP request";
253 std::string::size_type);
274 case eErrno:
return "System error";
275 case eModTime:
return "File system error";
300 switch ( GetErrCode() ) {
301 case eDoubleHeader:
return "Header has already been written";
328 switch ( GetErrCode() ) {
329 case eHeaderSent:
return "Header has been written";
358 switch ( GetErrCode() ) {
359 case eSessionId:
return "SessionId not specified";
360 case eImplNotSet:
return "Session implementation not set";
361 case eDeleted:
return "Session has been deleted";
389 switch (GetErrCode()) {
390 case eApp:
return "CGI application error";
399 #define NCBI_CGI_THROW_WITH_STATUS(exception, err_code, message, status) \
401 NCBI_EXCEPTION_VAR(cgi_exception, exception, err_code, message); \
402 cgi_exception.SetStatus( (status) ); \
403 NCBI_EXCEPTION_THROW(cgi_exception); \
406 #define NCBI_CGI_THROW2_WITH_STATUS(exception, err_code, \
407 message, extra, status) \
409 NCBI_EXCEPTION2_VAR(cgi_exception, exception, \
410 err_code, message, extra); \
411 cgi_exception.SetStatus( (status) ); \
412 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.