Purpose: Send a general error message to browser
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzHttpEvent::SendError | (HttpRC,const char*,) |
Declared in file: hzHttpServer.h
Defined in file : hzHttpServer.cpp
Function Logic:
Function body:
hzEcode hzHttpEvent::SendError (HttpRC hrc)const char* va_alist,
{
// Purpose: Send a general error message to browser
//
// Arguments: 1) hrc HTTP return code
// 2) va_alist Varaiable printf style arguments
//
// Returns: E_WRITEFAIL If the error message could not be sent
// E_OK If the operation was successful.
_hzfunc("hzHttpEvent::SendError") ;
va_list ap ; // Variable argument list
const char* fmt ; // Format control
hzChain Z ; // Output chain
va_start(ap, va_alist) ;
fmt = va_alist ;
Z << "<html>\n<head>\n<title>HadronZoo Internet Error Report</title>\n\n" ;
Z << "<style type=\"text/css\">\n" ;
Z << "<!--\n" ;
Z << ".a1 {text-decoration:none; font-family:arial; font-size:24px; font-weight:bold; color:#FFFFFF;}\n" ;
Z << ".a2 {text-decoration:none; font-family:verdana; font-size:13px; font-weight:bold; color:#000000;}\n" ;
Z << ".a3 {text-decoration:none; font-family:verdana; font-size:12px; font-weight:bold; color:#000000;}\n" ;
Z << "-->\n" ;
Z << "</style>\n" ;
Z << "</head>\n" ;
Z += "<body bgcolor=#CCCCCC>\n" ;
Z << "<table width=100% border=0 cellspacing=0 cellpadding=0>\n" ;
Z << "<tr height=100 bgcolor=#000000>\n" ;
Z << " <td align=center class=a1>HadronZoo Internet Error Report<td>\n" ;
Z << "</tr>\n" ;
Z << "<tr height=400 bgcolor=#F0FFF0>\n" ;
Z << " <td align=center class=a2>" ;
Z._vainto(fmt, ap) ;
Z << "</td>\n" ;
Z << "</tr>\n" ;
Z << "<tr height=50 bgcolor=#CCCCCC>\n" ;
Z << " <td align=center class=a3>Powered by HadronZoo</td>\n" ;
Z << "</tr>\n" ;
Z << "</table>\n" ;
Z << "</body>\n" ;
Z << "</html>\n" ;
if (SendRawChain(hrc, HMTYPE_TXT_HTML, Z, 0,false) != E_OK)
{
hzerr(E_WRITEFAIL, "Response data not sent (size=%d, sock=%d)", Z.Size(), m_pCx->CliSocket()) ;
return E_WRITEFAIL ;
}
return E_OK ;
}