Throwing with Can-Find

Posted by alextrs on 21-Oct-2010 11:07

Hi Guys,

Why if I use "UNDO, THROW" in "IF CAN-FIND block" it throws an empty message?

ROUTINE-LEVEL ON ERROR UNDO, THROW.

DEFINE TEMP-TABLE ttTest
    FIELD Sy-Test AS INT.

RUN test NO-ERROR.
IF ERROR-STATUS:ERROR THEN
    MESSAGE ERROR-STATUS:GET-MESSAGE(1)
        VIEW-AS ALERT-BOX INFO BUTTONS OK.

PROCEDURE test:
    IF NOT CAN-FIND (ttTest) THEN
        UNDO, THROW NEW PROGRESS.Lang.AppError ("Can't find this record!!!", 1).
END.

if I do something like:

PROCEDURE test:
    IF 1 <> 2 THEN
        UNDO, THROW NEW PROGRESS.Lang.AppError ("Can't find this record!!!", 1).
END.

Everything is fine.

OpenEdge 10.1C04

All Replies

Posted by sarahm on 26-Oct-2010 13:31

This is a bug that occurs in 101c04 and the initial release of 102a, but is has been fixed in the latest 102a service pack.  In the meantime, I found that removing the message number argument from the AppError instantiation and adding RETURN-VALUE to your MESSAGE statement successfully displays your error message.  This creates an AppError with a value in the RETURN-VALUE property rather than the list of messages.  This might be a suitable workaround.

IF

ERROR-STATUS:ERROR THEN

MESSAGE ERROR-STATUS:GET-MESSAGE(1) RETURN-VALUE

VIEW-AS ALERT-BOX INFO BUTTONS OK.

...

UNDO

, THROW NEW PROGRESS.Lang.AppError ("Can't find this record!!!" /*, 1 */).

This thread is closed