Skip to content

Error Number Changes

Errors

In DataFlex 8.2, we cleaned up error reporting in the runtime, compiler, and packages. We did this by:

  1. Removing all specific error numbers in packages (e.g., error 42) and replacing them with their symbolic names as defined in errornum.inc (e.g., error Dferr_Find_Past_End_Of_File).
  2. Reassigning all the ad-hoc errors to real errors. Ad-hoc error numbers are the numbers that get assigned that have no association with errors defined in the error data files. Examples of this are error 300, error 999, and error 500.
  3. Providing a method so that the need to create ad-hoc errors will disappear.
  4. Making sure that all errors are reported with the Error command. We removed all message box errors.
  5. Creating new error entries as needed.
  6. Updating the errornum.inc file in your pkg directory. It now contains symbolic names for all error files. You may wish to review this file.
  7. Changing the runtime so that it provides context information for many of the confusing runtime error messages. For example, when a file cannot be opened, the runtime will now report the file name.

Most of these changes will not impact your existing applications.

New Generic Errors

The four most important errors added are generic errors:

  • DfErr_Compile
  • DfErr_Operator
  • DfErr_Program
  • DfErr_Setup

These errors have entries in the error file with error text that is intentionally left blank. You should use these errors when you need to report an error where you wish to provide all of the error message text within your code. These were created so that you will no longer need to generate errors with ad-hoc error numbers. You will use this most frequently to report operator and program errors.

For example, let's say you wish to report an error in your program that states, "You cannot enter negative inventory quantities." Prior to this change, there were two ways to generate this error:

Error DfErr_Operator_Error "You cannot enter negative inventory quantities"
Error 300 "You cannot enter negative inventory quantities"

The first method would generate the error "Operator error. You cannot enter negative inventory quantities." However, you wanted to control the entire error text and you do not want to see "Operator error." This text is provided by flexerrs.dat, the error data file.

The second method would generate the error "You cannot enter negative inventory quantities." This is what you want, but to do this, you've been forced to use an ad-hoc error number (300).

You would now use DfErr_Operator. It is a real error, but the text provided from the error file is blank. Here are some examples of how you might use these errors:

Error DfErr_Operator "You cannot enter negative inventory quantities"
Error DfErr_Program "Bad data passed in MySpecialProcedure. Contact your programmer."

Error Changes in flexerrs.dat

In DataFlex 8.2, we made two changes in the flexerrs.dat file. We have replaced error 101 with a new error and we have removed error 102. (Actually, we moved the original contents of 101 and 102 to dferr001.dat.)

Err# Error name in errornum.inc Error Description Note
101 Dferr_Cant_Change_Key_Field Can't change key field operator
102 removed

Error numbers in flexerrs.dat between 121 and 4095 are reserved for developer custom errors. If you are maintaining custom errors in this file, you can make these two changes in your custom flexerrs.dat file using the Error Maintenance utility.

In future revisions of DataFlex, we will make few and hopefully no changes to this file.

Error Changes in DfErr001.dat

Dferr001.dat (and all error files except for flexerrs.dat) should not be changed by the developer. The exception to this rule will be language translation.

Here is a list of all changes in dferr001.dat. Notice the generic errors (4400-4403) are defined in this file:

Err# Error name in errornum.inc Error Description Note
4388 Dferr_Comp_Illegal_Object_Defintion Illegal object name definition Compiler
4389 Dferr_Comp_Illegal_Property_Defintion Illegal property name definition Compiler
4390 Dferr_Comp_Illegal_Method_Defintion Illegal method name definition Compiler
4391 Dferr_Comp_Illegal_Code_Placement Illegal code placement Compiler
4392 Dferr_Comp_Invalid_Method_Syntax Invalid method syntax Compiler
4393 Dferr_Comp_Invalid_Message_Syntax Invalid message syntax Compiler
4394 Dferr_Comp_Invalid_Object_Reference Invalid object reference Compiler
4395 Dferr_Comp_Obsolete_Unsupported_Feature Obsolete command is unsupported Compiler
4396 Dferr_Comp_Invalid_Argument Invalid argument Compiler
4397 Dferr_Comp_Illegal_External_Function_Definition Illegal external function definition Compiler
4400 Dferr_Compile Compiler
4401 Dferr_Operator Operator
4402 Dferr_Program Program
4403 Dferr_Setup Setup
4404 Dferr_Winprint Winprint error Program; Operator
4406 Dferr_Dftimer Timer (dfTimer) error Program
4407 Dferr_Flexcom Flexcom error Program
4408 Dferr_Help_System Help system error Program
4409 Dferr_Ini_File Ini file error Program
4410 Dferr_Windows Windows error Program
4411 Dferr_Registry Windows registry error Program
4412 Dferr_Serial_Comm Serial Communications (SerialComm) error Program
4413 Dferr_Windows_Menu Windows Menu error Program
4414 Dferr_Mapi Mapi error Program
4415 Dferr_cApplication Application/Workspace error Operator; Setup