Show TOC

 Creating Exceptions for MethodsLocate this document in the navigation structure

Use

When you create an exception for a method, you can use the classical exceptions or the new class-based exceptions. If you use the class-based method, at runtime exceptions are represented as objects of exception classes.

Prerequisites

The method for a class or interface already exists.

Procedure
  1. In the method display of the Class Builder, position the cursor on the name of the corresponding method.
  2. Choose the Exceptions pushbutton.
  3. If you want to define normal exceptions for the method, enter the following information:
    1.  Exception: Specify a suitable name for the exception using the naming conventions for exceptions.
    2. Description: Short description of the exception.
  4. If you want to create a class-based exception, first activate the Exception Classes indicator and then enter the appropriate exception class in the Exception column. When you press ENTER, the Class Builder checks if the specified exception class already exists. If a class with that name does not exist, you can create it. If the class exists, the system copies its parameters.
Result

You defined exceptions for a method and can implement the method.

See also:

Defining Exception Classes

Implementing Methods .