10. Data Entry Error Handling : How You Can Use Data Entry Error Handlers : How You Can Access a Hierarchy of Data Entry Error Handlers : How You Can Pass Control to Another Error Handler
 
Share this page                  
How You Can Pass Control to Another Error Handler
The another_handlerproc procedure returns EH_NEXT_HANDLER, causing OpenROAD to search the parents of this frame for other data entry error handlers. Because the frame that defines the handlerproc procedure is the parent frame, control passes to the handlerproc procedure.
The following is the complete code for the another_handlerproc procedure:
procedure another_handlerproc(
    errorfield = entryfield;
    errorframe = frameexec;
    errormessage = varchar(2000) not null) =
declare
    str = varchar(100) not null;
enddeclare

begin
    message 'Error in field' + errorfield.Name +
    HC_NEWLINE +
    errormessage;
    return EH_NEXT_HANDLER;
end;
Although this procedure uses the message statement to compose the error information, the text of the message is written to the w4gl.log file rather than displayed in a pop-up frame. Statements that usually cause display of a pop-up frame (such as the message statement and the ConfirmPopup method) perform differently when executed from within a data entry error handler. For a discussion of other restrictions, see Restrictions on Data Entry Error Handlers (see Restrictions on Data Entry Error Handlers).
The following statement from the frame's initialize block establishes the another_handlerproc procedure as its error handler:
CurFrame.DataEntryErrorHandler =
    CurFrame.Scope.GetProcHandle(name =
    'another_handlerproc');