First of all you would need to add OnErrorStop to the throwError code otherwise RaiseError is ignored because of the OnErrorResumeNext mode. Second, please run this script in the debugger and set new breakpoint on the throwError line. When you reach that line click Debug/Step In menu and check what is happening there. : My call to the error condition is : onErrorResumeNext : // Check for file or raise error : FileExists sourceCombine, fileOK : ifThen(fileOK, labelFileFound) : throwError("Could not write to the log file",5) : labelFileFound: // rest of the script here : the function is : OnErrorStop : LogAddMessageEx "ERROR", @V"job_id", : "@V"job_name"", error : RaiseError error : The function is : throwError(message,severity) : i would expect that the error is thrown, and it is 'ignored' and the script : resumes. : When throwError is called, it says to stop on error, and then the error is : called by LogAddMessageEX, and even by RaiseError : in its original form.. NO errors were logged during 'Run now' : since I have turned off 'run in background'.. run now throws a message out to : the log, but it is not a STOP... the script continues to process unless i : call exit OUTSIDE the sub script
|