Throw Statement The Throw statement causes Siebel eScript to stop running code

Throw statement the throw statement causes siebel

This preview shows page 71 - 74 out of 334 pages.

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. 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. Table 25. Arguments for the Throw Statement Argument Description exception An object in an error class.
Image of page 71
Siebel eScript Language Reference Version 8.1, Rev. A Statements Reference 72 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” on page 72 . Try Statement The Try statement processes an exception. It handles functions that can raise an exception , which is an error condition that causes the script to branch to another routine. It can include the following clauses: Catch clause. Handles the exception. To raise an exception, you use the Throw statement. For more information, see “Throw Statement” on page 71 . Finally clause. Performs cleanup work. For example, removing object references. To trap errors that a statement block creates, you can do the following: Place code that must trap errors in a Try statement.
Image of page 72
Statements Reference Siebel eScript Language Reference Version 8.1, Rev. A 73 Follow the Try statement with a catch clause. To process the exception, you can use the exception_handling_block argument in this catch clause. Format try { statement_block } catch { exception_handling_block [throw exception ] } finally { statement_block_2 } Table 26 describes the arguments for the Try statement. Example The following example demonstrates the general format of a Try statement that includes a catch clause. In this example, Siebel eScript continues to run the script after it displays the error message: try { do_something; } catch( e ) { TheApplication().RaiseErrorText(Clib.rsprintf( "Something bad happened: %s\n",e.toString())); } Table 26. Arguments for the Try Statement Argument Description statement_block A statement block that can create an error.
Image of page 73
Image of page 74

You've reached the end of your free preview.

Want to read all 334 pages?

  • Summer '16
  • Oracle
  • Type system, Siebel, Siebel eScript

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes