Preserving Errors During Recovery Processing
When your client application is handling an error, it is important to realize that any Broker function that you call as part of the error processing may overwrite the original error. The following example shows how to copy the original error and ensure that it is restored before returning.
If you make a copy of the global error, you must manage the memory associated with your copy. You typically want to return system managed errors.
. . .
BrokerError err;
BrokerError temp_err;
. . .
if (err != AW_NO_ERROR){
temp_err = awCopyError(err);
/* Error processing that may call other webMethods Broker functions */
. . .
err = temp_err;
awSetCurrentError(err);
return err;
}
. . .