Error command¶
Include: Use System\ErrorSystem.pkg
See Also: Error System, Try/Catch, UserError, Error numbers, cBaseErrorHandler
Purpose¶
Signals an error to the Error System.
Syntax¶
Error {error-num} [{message}]
Arguments¶
{error-num}
: Error number to report. Use named DFERR_* constants such as DFERR_PROGRAM instead of hard-coded numbers.
{message}
: Optional error text. The message may not exceed 1000 characters.
How it works¶
Error reports an error immediately. It records the error number as LastErr, records the source line as Errline, sets Err to true, and routes the error through the current Error System handler.
Error versus UserError¶
Error is the general command for reporting an error number and optional text. UserError is the helper for user-facing messages with an optional caption and handler-controlled user-error presentation.
Example¶
If (sCustomerName = "") Begin
Error DFERR_OPERATOR "Customer name is required."
End