Bookshelf Home | Contents | Index | PDF |
Siebel eScript Language Reference > Siebel eScript Language Overview > Siebel eScript Statements > try StatementThe try statement is used to process exceptions that occur during script execution. Syntaxtry
UsageThe try statement is used to handle functions that may raise exceptions, which are error conditions that cause the script to branch to a different routine. A try statement generally includes a catch clause or a finally clause, and may include both. The catch clause is used to handle the exception. To raise an exception, use the throw statement (see throw Statement). When you want to trap potential errors generated by a block of code, place that code in a try statement, and follow the try statement with a catch statement. The catch statement is used to process the exceptions that may occur in the manner you specify in the exception_handling_block. The following example demonstrates the general form of the try statement with the catch clause. In this example, the script continues executing after the error message is displayed: try The finally clause is used for code that should always be executed before exiting the try statement, regardless of whether the catch clause halts the execution of the script. Statements in the finally clause are skipped only if the finally clause redirects the flow of control to another part of the script. The finally statement can be exited by a goto, throw, or return statement. try Execution continues with the code after the label, so the return statement is ignored. See Also |
Siebel eScript Language Reference |