STOP condition
- Last Updated: April 29, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
ABL supports a STOP statement that
lets the user terminate or restart your application altogether if
an unrecoverable error occurs. You can trap the STOP condition
in your block header statements as well. The STOP condition occurs
when an ABL STOP statement executes or when the user
presses the keyboard key mapped to that value. The STOP key,
by default, is mapped to CTRL+BREAK in
Windows and CTRL+C on UNIX.
When the STOP condition occurs, by default
the AVM undoes the current transaction (if any). If the user starts the application from an
OpenEdge tool, such as the Procedure Editor, OpenEdge terminates the application and returns
to that tool. Otherwise, if the user starts the application using the Startup procedure
(-p) startup option on the session, OpenEdge reruns the
startup procedure.
OpenEdge raises the STOP condition when an
unrecoverable system error occurs, such as when a database connection
is lost or an external procedure that your code runs cannot be found.
You cannot put the NO-ERROR condition on a RUN statement
for an external procedure, as you can for an internal procedure.
Therefore, the only way to trap such an error is to put the statement
in a DO ON STOP block such as this:
|
If the procedure is not found you still get an error, as shown in the following figure.
But your procedure continues executing and you can deal with the error, as shown in the following figure.
If you anticipate that this might happen, it is better to use
the SEARCH function to determine in advance whether
the AVM can find the procedure in the current PROPATH:
|