Siebel eScript Language Reference > Statements Reference > Guidelines for Using Siebel eScript >

Throw Statement


The Throw statement causes Siebel eScript to stop running code if an error occurs.

Format

throw exception

Table 25 describes arguments for the Throw statement.

Table 25. Arguments for the Throw Statement
Argument
Description

exception

An object in an error class.

Usage

In the following example, the Throw statement stops the script after Siebel CRM displays an error message:

try
{
   do_something;
}
catch( e )
{
   TheApplication().Trace (e.toString()));

throw e;
}

Using the Throw Statement with Nested Try Catch Blocks

If any error occurs while processing a statement in a try block, then Siebel eScript creates an exception. An outer catch block can handle this exception. For example, assume a section of code includes three levels of try catch blocks:

  1. The innermost catch block includes a throw statement. An exception occurs.
  2. The catch statement in the level two block catches this exception.
  3. The catch statement in the level two block throws this exception to the level one block.
  4. The catch block at level one handles this exception.

The following code illustrates this example:

try

   {

   do_something;

   try

      {

      do_something;

      }

         catch(e)

      {

TheApplication().Trace(e.toString());

throw e;

      }

    }

      catch(e)

   {

TheApplication().RaiseErrorText("Error Occurred "+e.toString());

}

Related Topics

For more information, see Try Statement.

Siebel eScript Language Reference Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Legal Notices.