J
James Palmer
Guest
In a piece of w code, if using BLOCK-LEVEL error handling, do I need to handle the error inside each trigger or can I somehow throw it back up to be handled in a single place in the code? I'll try and explain with a code snippet. ON CHOOSE OF BUTTON-1 IN FRAME fra-LinkMTS /* Button 1 */ DO: FIND metersite NO-LOCK. CATCH PLE AS Progress.Lang.Error : MESSAGE 123 VIEW-AS ALERT-BOX. UNDO, THROW PLE. END CATCH. END. MAIN-BLOCK: DO ON ERROR UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK: RUN enable_UI. RUN ColourSet IN gv-library-handle (INPUT FRAME {&FRAME-NAME}:HANDLE, INPUT-OUTPUT lv-current-window-handle). RUN Initialise IN THIS-PROCEDURE. IF NOT THIS-PROCEDURE
ERSISTENT THEN WAIT-FOR CLOSE OF THIS-PROCEDURE. CATCH PLE AS Progress.Lang.Error : UNDO, THROW PLE. END CATCH. END. CATCH PLE AS Progress.Lang.Error : MESSAGE "An error occurred." SKIP PLE:GetMessage(1) SKIP PLE:GetMessage(2) VIEW-AS ALERT-BOX ERROR. END CATCH. So in the above, errors in Initialise are handled by my custom message, but whilst the catch in the trigger is firing, I still get the standard Progress error message, and not the custom one I've defined. If I put my error handling code in the trigger's catch then it works as I'd hope, but I'd rather just handle the error messaging in one place. Obviously I can move my error handling to a class and have a central way of dealing with it there, but I'm trying to understand what's happening.
Continue reading...
Continue reading...