Try OpenEdge Now
skip to main content
Object-oriented Programming
Programming with Class-based Objects : Raising and handling error conditions : Raising errors within an instance constructor
 

Raising errors within an instance constructor

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 PROPATH or 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 the ERROR condition and throws a Progress.Lang.SysError object 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 the PROPATH. Thus, you must ensure that all classes in a class hierarchy are properly compiled. For more information, see Compiling 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 ERROR or an UNDO, THROW to raise the ERROR condition on the constructor.
* Handling instance constructor errors
* Instance constructor error handling example