/* First technique for returning an application error from a
user-defined function. */ DEFINE VARIABLE FuncReturn AS LOGICAL NO-UNDO. FUNCTION ReturnAppError RETURNS LOGICAL: FIND FIRST Customer WHERE CustNum = 1000. RETURN TRUE. CATCH anyError AS Progress.Lang.ProError: UNDO, THROW NEW Progress.Lang.AppError("Function ReturnAppError failed."). END CATCH. END FUNCTION. ASSIGN FuncReturn = ReturnAppError(). CATCH myAppError AS Progress.Lang.AppError: DISPLAY "Error message returned from function: " myAppError:ReturnValue FORMAT "X(60)". END CATCH. |
/* Second technique for returning an application error from a
user-defined function. */ DEFINE VARIABLE FuncReturn AS LOGICAL NO-UNDO. FUNCTION ReturnAppError RETURNS LOGICAL: FIND FIRST Customer WHERE CustNum = 1000. RETURN TRUE. CATCH anyError AS Progress.Lang.ProError: UNDO, THROW NEW Progress.Lang.AppError("Function ReturnAppError failed."). END CATCH. END FUNCTION. ASSIGN FuncReturn = ReturnAppError() NO-ERROR. IF ERROR-STATUS:ERROR THEN DISPLAY "Error message returned from function: " RETURN-VALUE FORMAT "X(60)". |