Places an error message in the log file and returns control to the last previous API call in your application. wcTraceErr( ) raises an exception and WcTraceWarn() does not raise an exception; otherwise these two functions are identical.
returnCode = wcTraceWarn(cntrlHandle, retCode);
int wcTraceWarn(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 wcTraceWarn( ) 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 wcTraceWarn(wcp, ret); handleRequest(wcp); if((ret = wcConClose(wcp)) < 0) return wcTraceWarn(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( )
wcTraceErr( )