Using the raise_ Method
To raise user exceptions, use the raise_ method in the ExceptionClass class. (ExceptionClass is a subclass of the
exception-class-name.raise_(errorCode: Integer; errorItem: String);
The raise_ method automatically creates an exception of type exception-class-name and assigns the specified
The following example shows a method that raises an exception of type
initCompany(newCompany: Company io); begin if newCompany = null then NormalException.raise_(55, "Invalid Company"); endif; ... // perform the rest of the initialization logic end;
The following example shows a method used to raise an exception of type GraphException when two arrays contain a different number of entries.
checkForErrors(array1: StringArray; array2: IntegerArray); begin if array1.size <> array2.size then GraphException.raise_(3, "Arrays are the wrong size"); endif; end;
The GraphException class in this example is a user-defined