Forum Post: Re: Structured Error Handling In Triggers Confusion

Status
Not open for further replies.
P

Peter Judge

Guest
You can also remove the CATCH after the WAIT-FOR statement - it will never execute. The wait-for is a bit of a Gandalf statement. If you want errors to span a wait-for, you have to resort to jiggery-pokery along the lines of /* this variable is defined at the class level. */ define private variable moReadHandlerError as Error no-undo. method public void WaitForResponse(input piTimeout as integer): define variable iStartTime as integer no-undo. Assert:IsZeroOrPositive(piTimeout, 'Timeout'). assign moReadHandlerError = ? moReadEventArgs = new SocketReadEventArgs(piTimeout) iStartTime = mtime mhSocket:sensitive = true. wait-for 'U2':u of mhSocket. LogMessage('READ: TOTAL TIME(ms)=':u + string(mtime - iStartTime), 5). /* 'catch' the errors from the handler after the wait-for. */ if valid-object(moReadHandlerError) then return error moReadHandlerError. end method.

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