throw to debug Siebel eScript
“throw” statement in Siebel eScript is inherited from the ECMA script. It will pass the error details back to the caller if there is an error during the script execution.
The error message reaches the highest level, and then there are no more levels it just gets thrown back to requester.
Consider a business service that calls an internal custom function from its Service_PreInvokeMethod method. If you use “throw” statements both in the pre-invoke method and in the custom function, this is what you will observe..
Service in question is called from from the Business Service Simulator. You will see the same behaviour even if you call the business service from a button, user property, or other scripts.
As you can see from the screenshot, it becomes really easy to locate the source of the problem. In this case it was a typo error - script has GetBusinessObject instead of GetBusObject.
Though “throw” makes it very easy for a developer to debug the scripts, complex error messages are not encouraged to be shown to the end user. You can then use TheApplication().RaiseErrorText in the custom function to simplify the error message.
Although this is still cryptic, the users are assured to not freak out by looking at the error message.