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.
returnCode = wcTraceErr(cntrlHandle, retCode);
int wcTraceErr(void *controlHandle, int errorCode)
controlHandle | The handle to the control structure. |
errorCode | The 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. |
0 | Success. |
Error code | Failure or exception. For a list of possible error codes, see Error Messages. |
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.
wcLogPrintf( )
wcMessagePage( )
wcTraceWarn( )