Raise errors within an instance constructor
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
There are two types of errors that can occur during the creation of an object:
-
Instantiation error — Caused by any number of system errors, such as when the class
file or a class file in the class hierarchy (source code or r-code) is not found on the
PROPATHor there is an incorrectly coded signature for one of the constructors in the class hierarchy. For those instantiation errors that you do not or cannot handle within a constructor, the AVM automatically raises theERRORcondition and throws aProgress.Lang.SysErrorobject on the constructor.Note: An improper signature can appear in a previously compiled class hierarchy if out-dated r-code for one of the classes is found and executed on thePROPATH. Thus, you must ensure that all classes in a class hierarchy are properly compiled. For more information, see Compile class definition files.
-
Application error — Your application logic encounters an
abnormal condition that it handles in one of the constructors in
the class hierarchy using one of the available error handling mechanisms.
For any such handled error, you can use a
RETURN ERRORor anUNDO, THROWto raise theERRORcondition on the constructor.