ClearBox Server™ v1.2 Developer's Guide

IServer2::LogExtensionError

Allows server extension to log its errors in server errors logfile.

This method can be used when more than one error occur during server extension execution, and simply returning error code from erroneous method is not enough.

HRESULT FailureShutdown(
	[in] HRESULT erCode,
	[in] BSTR errDescription);

Parameters

erError
[in] Error code that possibly describes the error.
errDescription
[in] Error description that will be written to the log.

Return Values

This method always returns S_OK.

Thread Safety

This method can be called from any thread.

Memory Management

Server extension should allocate and free memory for errDescription parameter.

Remarks

This method is useful as it may be called several times within one server extension method.

Example Code

This code uses m_pServer as IServer interface pointer stored in ICommonExtenderEx::InitializeEx implementation. In this example server extension logs its error as a string "An error has occurred".

if (/* something goes wrong */)
{
	IServer2* pS2=NULL;
	m_pServer->QueryInterface(IID_IServer2,(void**)&pS2;
	//QueryInterface will always succeed
	BSTR errD=SysAllocString(L"An error has occurred!");
	pS2->LogExtensionError(E_FAIL,errD);
	SysFreeString(errD);
	// Call to  pS2->Release() is not necessary 
}

See Also

IServer2, Server services


© 2001-2003 XPerience Technologies. www.xperiencetech.com

Created by chm2web html help conversion utility.