Raise errors within a property
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
Error handling for GET and SET accessors
works similar to the way it does for methods. In this respect, a GET accessor
corresponds to a method (non-VOID) that returns
a value and a SET accessor corresponds to a method (VOID)
that does not return a value. So, when you read or write a property
in a statement, if the property accessor returns ERROR from
a RETURN ERROR, an UNDO, THROW,
or an unhandled system error, ABL raises the ERROR condition
on this statement, which you can handle appropriately in the associated
block.
Error handling within property accessors works exactly like it
does for raising and handling errors within methods. For example,
you can include blocks within property accessors to handle ERROR conditions,
using the options of the ON ERROR phrase and you can
include CATCH blocks in any UNDO block,
including the accessor block.
UNDO processing, within a property accessor, Progress Software Corporation recommends
that you employ the simplest processing possible within property
accessors. Avoid any processing that involves long execution times,
database processing, or any other processing that might result in
unexpected side-effects.