During replay of an Oracle Forms BDF script if an expected Message Box or Window is not returned then an error message similar to following will be returned: OraForms: 5 - Handler not found, Healthy Living Demo Note: "5 - Handler not found" is the error message and "Healthy Living Demo" is the name of the MessageBox Window. During a loadtest it often does not make sense for a virtual user to continue executing the BDF script if an expected MessageBox or Window is not returned (as this will only lead to subsequent error messages being reported). Therefore it can make sense to trap this type of error and force the virtual user to exit the Transaction. The sample code below does this by first catching the error "OraForms: 5 - Handler not found", then writing the full error message (including the name of the MessageBox or Window to the Output (.wrt) file before writing a custom error message to the SilkPerformer Log files (.Err, .Log and .Rpt) and exiting the transaction. dclevent handler HandlerStopIteration var x : number; sErrorNumber : string; sFacility : string; sSeverity : string; sUsr : string; sAddedInfo : string; sErrorMessage : string; sTemp : string; begin // capture the last error message to occur during runtime x := GetLastError(0, 0, SEVERITY_ERROR, sAddedInfo); sErrorNumber := String(GetErrorCode(x)); sFacility := String(GetErrorFacility(x)); sSeverity := String(GetErrorSeverity(x)); sUsr := GetUser(); sTemp := GetErrorMsg(x); sErrorMessage := sTemp + " - " + sAddedInfo; // write error information to the output (.wrt) file writeln("===================Last Error Handled======================="); writeln("Error Nr. : " + sErrorNumber); writeln("Facility : " + sFacility); writeln("Severity : " + sSeverity); writeln("Error Msg : " + sErrorMessage); writeln("Virtual User : " + sUsr); writeln("============================================================"); // if error OraForms: 5 - Handler not found is the last error to occur then exit transaction else exit event handler and return to runtime if GetErrorCode(GetLastError()) = 5 then RepMessage("Message Box not returned; Virtual User will be Terminated", SEVERITY_TRANS_EXIT); else throw; end; end HandlerStopIteration;
↧