Try OpenEdge Now
skip to main content
Error Handling
Raising errors with THROW : THROW with error objects : THROW compared with RETURN ERROR

THROW compared with RETURN ERROR

By way of contrast, the RETURN ERROR statement can also be used to raise an AppError object. It raises ERROR and also provides the ability to specify a CHARACTER string that can be accessed in the caller (usually the ReturnValue property of the error object or the RETURN-VALUE function). The RETURN ERROR statement allows you to return an error object. For example:
IF CurrentTime > ClosingTime THEN
    RETURN ERROR NEW Progress.Lang.AppError("Can't take a delivery order
                                             after closing time.").
RETURN ERROR does not provide the UNDO action as does the UNDO, THROW statement.
The following language elements support a RETURN ERRORerror-object-expression action:
*RETURN statement
*ON ENDKEY phrase
*ON ERROR phrase
*ON QUIT phrase
*ON STOP phrase
*UNDO statement