Kbase P134962: How to throw Progress.Lang.AppError exceptions?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  9/15/2008 |
|
Status: Unverified
GOAL:
How to throw Progress.Lang.AppError exceptions?
GOAL:
How to use Progress.Lang.AppError class?
FACT(s) (Environment):
OpenEdge 10.1C
All Supported Operating Systems
FIX:
CONSTRUCTOR PUBLIC AppError(): default constructor for AppError class. This creates an AppError object with an empty message list and does not set any properties.
CONSTRUCTOR PUBLIC AppError( INPUT ErrorMessage AS CHARACTER, INPUT MessageNumber AS INTEGER ): Assigns the first message on the object with the values from the ErrorMessage and MessageNumber arguments. The error message and message number can be accessed with GetMessage(1) and GetMessageNum(1) methods on the AppError. This constructor sets the NumMessage property on the AppError to 1.
Example:
DEF TEMP-TABLE tt
FIELD custNum AS INT.
DO ON ERROR UNDO, THROW:
FIND FIRST tt EXCLUSIVE-LOCK NO-WAIT NO-ERROR.
IF NOT AVAILABLE( tt) THEN
UNDO, THROW NEW PROGRESS.Lang.AppError( "Opps", 999 ).
END.
CATCH ae AS PROGRESS.Lang.AppError:
MESSAGE "message:" ae:GetMessage(1) SKIP
ae:GetMessageNum(1) SKIP
view-as ALERT-BOX.
DELETE OBJECT ae.
END CATCH.
CONSTRUCTOR PUBLIC AppError( INPUT ErrorString AS CHARACTER ): contructs an error object with the ReturnValue property set with the value of the ErrorString parameter.
Example:
DEF TEMP-TABLE tt
FIELD custNum AS INT.
DO ON ERROR UNDO, THROW:
FIND FIRST tt EXCLUSIVE-LOCK NO-WAIT NO-ERROR.
IF NOT AVAILABLE( tt) THEN
UNDO, THROW NEW PROGRESS.Lang.AppError( "Opps" ).
END.
CATCH ae AS PROGRESS.Lang.AppError:
MESSAGE "ReturnValue:" ae:ReturnValue
view-as ALERT-BOX.
DELETE OBJECT ae.
END CATCH.