[progress Communities] [progress Openedge Abl] Forum Post: Re: Abl Unhandled Exceptions, Or...

  • Thread starter Thread starter slacroixak
  • Start date Start date
Status
Not open for further replies.
S

slacroixak

Guest
OOOps, my wrong... the ON STOP UNDO, RETRY approach actually works fine, even for the classic MAIN-BLOCK. I was doing something wrong before my IF RETRY THEN DO: block. So at the end of the day 1) I have a way to detect a STOP condition : I will use the RETRY option only for the ON STOP Phrase, so the RETRY function says TRUE only in case of a STOP. 2) I notice the ON STOP UNDO, RETRY can even catch the STOP condition for a classic MAIN-BLOCK with an active WAIT-FOR (although I may use it at a parent level without any WAIT-FOR) 3) The last missing bit is to catch the error message details with the name of the offending missing procedure. For now, I would work it around with a SessionManager Class a few static members: DEFINE PUBLIC STATIC PROPERTY IsPendingRunValue AS LOGICAL NO-UNDO GET. PRIVATE SET. DEFINE PUBLIC STATIC PROPERTY PendingRunValueFileName AS CHARACTER NO-UNDO GET. PRIVATE SET. METHOD PUBLIC STATIC VOID SetPendingRunValue(pcFileName AS CHAR): SessionManager:IsPendingRunValue = TRUE. SessionManager:PendingRunValueFileName = pcFileName. END. METHOD PUBLIC STATIC VOID ResetPendingRunValue(): SessionManager:IsPendingRunValue = FALSE. END. Then use it this way: /* launcher.p */ DO ON ERROR UNDO, LEAVE ON STOP UNDO, RETRY: IF RETRY AND SessionManager:IsPendingRunValue = TRUE THEN DO: MESSAGE "RETRY case probably coming next to a STOP due to Error 293 for procedure " SessionManager:PendingRunValueFileName SKIP VIEW-AS ALERT-BOX. QUIT. END. RUN mainwindow.w. END. /* mainWindow.w:*/ [...] ON CHOOSE OF btn293 IN FRAME fMain /* Cause error 293 RUN nonExisting.p */ DO: DEFINE VARIABLE cFileName AS CHARACTER NO-UNDO. cFileName = "nonExisting.p". SessionManager:SetPendingRunValue(cFileName). RUN VALUE (cFileName). /* on purpose */ SessionManager:ResetPendingRunValue(). END. The last point I do not like is that if a STOP occurs in the flow after the RUN VALUE statement, but before the next line (so while the called .p remains in the stack), then my IsPendingRunValue property is still set, that could make me wrongly assume an error 293 occurred. The solution is to call SessionManager:ResetPendingRunValue() at first line in every .p called by a RUN VALUE... So indeed, Laura, a new mechanism to just raise an ERROR instead of a STOP condition would be much nicer. Still I would appreciate if you could reveal me another secret way to retrieve the last displayed error message (something with more details that _msg() ). Best regards /SL

Continue reading...
 
Status
Not open for further replies.
Back
Top