Siebel VB Language Reference > Using Siebel VB > About Error Handling >

Handling Errors That Siebel VB Returns


This topic describe how to write code that handles the errors that Siebel VB returns.

Using the Body of the Code to Handle Siebel VB Errors

To handle errors in the body of code, you place the code that handles the error immediately before the line of code that could cause an error.

Figure 2 includes an example that handles errors in the body of the code.

Figure 2. Example That Handles Errors In the Body of the Code
Explanation of Callouts

The example that handles errors in the body of the code includes the following items:

  1. The On Error statement identifies the line of code to run if an error occurs.
  2. The If statement handles the error. It uses the Err statement to identify the error that Siebel VB returns.
  3. The Resume Next argument instructs Siebel VB to proceed to the next line of code after it handles the error.

Using an Error Handler to Handle Siebel VB Errors

Figure 3 includes an example that uses an error handler to handle errors.

Figure 3. Example That Handles Errors With an Error Handler
Explanation of Callouts

The example that uses an error handler to handle errors includes the following items:

  1. The On Error statement identifies the line of code that Siebel CRM runs if an error occurs. The code segment is part of the main code and it uses the Err statement to determine the error code that Siebel VB returns.
  2. You precede the code with an Exit statement to make sure that it does not accidentally proceed to the error handler.
Siebel VB Language Reference Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Legal Notices.