wcTraceErr( )

Syntax . . Returns . . Program Example . . Related Topics . . A-Z Index . . Home

Places an error message in the log file, raises an exception and returns control to the last previous API call in your application. If your application does not handle exceptions, use wcTraceWarn( ) instead. WcTraceErr( ) raises an exception and wcTraceWarn( ) does not raise an exception ; otherwise these two functions are identical.

Example

returnCode = wcTraceErr(cntrlHandle, retCode);

Syntax

int wcTraceErr(void *controlHandle, 
               int errorCode)
controlHandleThe handle to the control structure.
errorCodeThe code number of the error you want to log. You can define your own error code or use one of the predefined codes described in Error Messages.

Returns

0Success.
Error codeFailure or exception. For a list of possible error codes, see Error Messages.

Program Example

The following code shows how wcTraceErr( ) is used in an application.

int requestLoop(wcp)
	void	*wcp;
{
	int	ret;

	/* set defaults */
	wcSetVariable(wcp, "MItab", "webPages");
	wcSetVariable(wcp, "MIcol", "object");
	wcSetVariable(wcp, "MInam", "ID");
	wcSetVariable(wcp, "MIval", "main");

	while(1)
	{
		if((ret = wcConOpen(wcp, 0)) < 0)
			return wcTraceErr(wcp, ret);

		handleRequest(wcp);

		if((ret = wcConClose(wcp)) < 0)
			return wcTraceErr(wcp, ret);
	}
}

In this code fragment, it is assumed that the function handleRequest( ) has been declared to return an HTML page to the browser.

Related Topics

wcLogPrintf( )
wcMessagePage( )
wcTraceWarn( )


Top of Page . . Syntax . . Returns . . Program Example . . A-Z Index . . Home