Structured Error Handling - Forum - OpenEdge Development - Progress Community
 Forum

Structured Error Handling

This question is answered

Completely lost with structured error handling 

My .p code

/* *******************************************************************************************************************

DO TRANSACTION ON ERROR UNDO, THROW :
       IF NOT AVAILABLE gdcf_broadcast_point THEN
       DO:
              UNDO, THROW NEW Lib.JITSErr("Broadcast Point not found for " + gdcf_broadcast_point.brdp_id).
        END.
END.
CATCH e AS CLASS JITSErr:

       MESSAGE 'ERROR2' e:ReturnMsg().
        RETURN ERROR e:ReturnMsg().
END CATCH.

/* *******************************************************************************************************************

Now my Class

CLASS Lib.JITSErr INHERITS AppError:

/*------------------------------------------------------------------------------
Purpose:
Notes:
------------------------------------------------------------------------------*/
DEFINE VARIABLE vErrorMessage AS CHARACTER.

CONSTRUCTOR PUBLIC JITSErr ( Msg AS CHARACTER ):

         ASSIGN
        THIS-OBJECT:vErrorMessage = Msg.

END CONSTRUCTOR.

/*------------------------------------------------------------------------------
Purpose:
Notes:
------------------------------------------------------------------------------*/

METHOD OVERRIDE PUBLIC CHARACTER GetMessage( MsgNum AS INT ):
                 DEFINE VARIABLE result AS CHARACTER NO-UNDO.
                 result = THIS-OBJECT:vErrorMessage.
                 RETURN result.

END METHOD.

METHOD PUBLIC CHARACTER ReturnMsg( ):

                 DEFINE VARIABLE result AS CHARACTER NO-UNDO.

                 MESSAGE 'INSIDE RETURN MESSAGE'.
                 result = THIS-OBJECT:vErrorMessage.
                 RETURN result.

END METHOD.


END CLASS.

In the above example when the Catch Block in .p executes content of the Class member vErrorMessage is empty - Why would that be ??????????????

Thanks for all the help 

Verified Answer
All Replies