Hi,
I'm using OpenEdge Release 10.2B07
Is there any way to catch stop conditions like failed run statement, for example:
DO ON ERROR UNDO, LEAVE: RUN nonexistent.p. message 1 view-as alert-box. CATCH eSysError AS Progress.Lang.SysError: MESSAGE "Show this error message". DELETE OBJECT eSysError. END CATCH. END.
Another situation:
And If at Run a P file that exist and has a compile error, how to catch this error ?
Thanks
How about:
do on stop undo, retry: if retry then do: log-manager:write-message ("STOP condition encountered", "SYSERROR"). undo, leave. end. do on error undo, leave: session:error-stack-trace = true. log-manager:logfile-name = chPrimaryLog. log-manager:clear-log (). /* Control log detail and event types */ log-manager:logging-level = 3. ...
How about:
do on stop undo, retry: if retry then do: log-manager:write-message ("STOP condition encountered", "SYSERROR"). undo, leave. end. do on error undo, leave: session:error-stack-trace = true. log-manager:logfile-name = chPrimaryLog. log-manager:clear-log (). /* Control log detail and event types */ log-manager:logging-level = 3. ...
This problem is an ancient one.
The AVM does not consider the absence of the target or a compile error in the target as an ERROR, but as a STOP condition.
You need to trap STOP with ON STOP. The problems are that you cannot suppress the error message raised by the STOP condition on the RUN statement and you cannot alter the behaviour of the ON STOP to do UNDO, THROW. You can only LEAVE, NEXT, RETRY or RETURN [ERROR] .
I've logged an enhancement request to change this at: community.progress.com/.../enable_on_stop_phrase_to_throw_errors.aspx
As it is on t he 11.6 list, you can only vote for it until the list closes tomorrow.