TimXmlRpc.cpp
// Converts a GetLastError() code into a human-readable string.
Converts a GetLastError() code into a human-readable string.
Converts a GetLastError () code into a human - readable string .
void XmlRpcImplementation::hadError(const char* function)
{   
	errmsg = function;
	errmsg += " : ";
	int LastError = GetLastError();
	if (LastError == ERROR_INTERNET_TIMEOUT)
		errmsg += "Internet timeout";
	else if (LastError == ERROR_INTERNET_INVALID_CA)
		errmsg += "Invalid certificate authority";
	else if (LastError == ERROR_INTERNET_SECURITY_CHANNEL_ERROR)
		errmsg += "Talking HTTPS to an HTTP server?";
	else if (LastError == ERROR_INTERNET_CANNOT_CONNECT)
		errmsg += "Failed to connect";
	else if (LastError == ERROR_INTERNET_INVALID_URL)
		errmsg += "Invalid URL";
	else if (LastError == ERROR_INTERNET_NAME_NOT_RESOLVED)
		errmsg += "Domain name not resolved";
	else if (LastError == ERROR_INTERNET_CONNECTION_RESET)
		errmsg += "Connection reset";
	else if (LastError == ERROR_INTERNET_NOT_INITIALIZED)
		errmsg += "Internet not initialised";
	else if (LastError == ERROR_INTERNET_CONNECTION_ABORTED)
		errmsg += "Connection aborted";
	else if (LastError == ERROR_INTERNET_SEC_CERT_REV_FAILED)
		errmsg += "Unable to check whether security certificate was revoked or not. Is your system clock time correct?";
	else {
		static char* buf;
		FormatMessageA(
				FORMAT_MESSAGE_ALLOCATE_BUFFER |
				FORMAT_MESSAGE_FROM_SYSTEM |
				FORMAT_MESSAGE_IGNORE_INSERTS,
				NULL,
				LastError,
				MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 
				(char*)&buf,
				0,
				NULL
		);
		if (buf == NULL) {
			char tmp[512];
			sprintf_s(tmp, "Error %d", LastError);
			errmsg += tmp;
		}
		else {
			errmsg += buf;
		    LocalFree(buf);
		}
	}
}
void XmlRpcImplementation :: hadError ( const char * function ) { errmsg = function ; errmsg += " " ; int LastError = GetLastError ( ) ; if ( LastError == ERROR_INTERNET_TIMEOUT ) errmsg += " " ; else if ( LastError == ERROR_INTERNET_INVALID_CA ) errmsg += " " ; else if ( LastError == ERROR_INTERNET_SECURITY_CHANNEL_ERROR ) errmsg += " " ; else if ( LastError == ERROR_INTERNET_CANNOT_CONNECT ) errmsg += " " ; else if ( LastError == ERROR_INTERNET_INVALID_URL ) errmsg += " " ; else if ( LastError == ERROR_INTERNET_NAME_NOT_RESOLVED ) errmsg += " " ; else if ( LastError == ERROR_INTERNET_CONNECTION_RESET ) errmsg += " " ; else if ( LastError == ERROR_INTERNET_NOT_INITIALIZED ) errmsg += " " ; else if ( LastError == ERROR_INTERNET_CONNECTION_ABORTED ) errmsg += " " ; else if ( LastError == ERROR_INTERNET_SEC_CERT_REV_FAILED ) errmsg += " " ; else { static char * buf ; FormatMessageA ( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS , NULL , LastError , MAKELANGID ( LANG_NEUTRAL , SUBLANG_DEFAULT ) , ( char * ) & buf , 0 , NULL ) ; if ( buf == NULL ) { char tmp [ 512 ] ; sprintf_s ( tmp , " " , LastError ) ; errmsg += tmp ; } else { errmsg += buf ; LocalFree ( buf ) ; } } }
Converts a GetLastError() code into a human-readable string.
Converts a GetLastError () code into a human - readable string .
// Default language