catch all exceptions in .p program

subscripciones

New Member
I need a Generic catch for all exceptions in .p code, and store the Message in a variable, example:

DEF VAR err AS CHARACTER.

??
DEF VAR obj AS MEMPTR.
PUT-STRING(obj, 0) = "hello".
??

fill "err" variable in this case with = "PUT/GET functions not allowed on uninitialized memory. (2914)".

Must contemplate any exceptions. Something like try/catch in c# code.


thanks.
 
You don't mention a Progress version, but if it is recent enough look into
ROUTINE-LEVEL ON ERROR UNDO, THROW.
... that's about as close as you will get.

Closer to try/catch for a specific block, look at

block-statements
CATCH error-variable AS [ CLASS ] error-class:
catch-logic
END [ CATCH ] .
[ block-end-statement ]

again, assuming a current release.
 
You don't mention a Progress version, but if it is recent enough look into
ROUTINE-LEVEL ON ERROR UNDO, THROW.
... that's about as close as you will get.

Closer to try/catch for a specific block, look at

block-statements
CATCH error-variable AS [ CLASS ] error-class:
catch-logic
END [ CATCH ] .
[ block-end-statement ]

again, assuming a current release.



Progress Version 9.1
 
Progress Version 9.1

Ancient, obsolete and, unless it is 9.1E service pack 4, unsupported.
(If it is 9.1E04 "support" mostly means that you will have a shoulder to cry on immediately rather than having to wait to install the service pack before you get to cry on their shoulder.)

And just to be crystal clear... It has been 5 years since 9.1E service pack 4 was released. That was the very last release of version 9. There will never, ever be an enhancement or bug fix of any kind made to version 9.

For releases prior to 10.1C you are left with the old style techniques described in kbase P10608.
 
Back
Top