Error_report Command
Obsolete
This command is obsolete. Use the ErrorSystem class for error handling in DataFlex.
Purpose
To trigger reporting of pending errors through a specified error handler without affecting the program's default error-reporting timing or method.
Syntax
error_report
[label]
What It Does
Reporting of errors that occur in procedures and functions (processes) can be deferred by setting the value of the predefined variable error_type. If at any point in any process you wish pending errors reported and handled, the error_report command will "flush" any pending errors out to the report handler in effect.
If the label argument is supplied, the code starting at label will be executed to handle the error(s). If the argument is not supplied, the error will be reported according to whatever value of the predefined variable error_object_id, if any, is in effect. If an error routine is specified by an on error command, that routine is not used unless it is also named in the error_report command.
procedure fibonacci
:
error_report fibonacci
end_procedure
:
fibonacci:
show "Error in Fibonacci routine: "
:
return
In this example, the procedure fibonacci ends with an error_report command that identifies the label fibonacci as the subroutine to execute if errors are pending when execution of the routine is complete.
Notes
-
If multiple errors are pending, only the first one that occurred will be reported.
-
error_reportdoes not affect any error object oron errorsubroutine that may be in effect for general error handling, regardless of whether such error object or error subroutine is used by theerror_reportitself. -
The
on errorcommand also triggers error reporting, but it must name a label, and any label it names remains in effect after execution of the command. -
error_reportdoes not reset theerrpredefined variable. If you need this indicator set to false after error handling, you must supply explicit code to do so. -
Any input (e.g.,
entry_item, etc.) command always triggers reporting of all errors prior to accepting input.