JavaScript Editor js editor     Web development 



Main Page

Creates a variable array containing information about the most recent Visual FoxPro, OLE, or ODBC error.

AERROR(ArrayName)

Parameters

ArrayName


Specifies the name of the array for AERROR(В ) to create.

Return Value

Numeric. AERROR(В ) returns the number of rows in the array.

Remarks

AERROR( ) creates an array with seven columns containing information about the error. The type of error that occurred determines the number of rows in the array.

Note:
If no error occurred, AERROR(В ) does not create the array.

When a Visual FoxPro error occurs, the array contains one row. The following table describes the contents of each element.

Element number Description

1

Numeric. The number of the error. Identical to the value returned by ERROR(В ).

2

Character. The text of the error message. Identical to the value returned by MESSAGE(В ).

3

The null value. However, if the error has an additional error parameter, contains the text of the error parameter. Almost identical to the value returned by SYS(2018), the difference being that AERROR(В ) returns mixed case but SYS(2018) returns all uppercase.

4

The null value. However, as appropriate, contains the number of the work area in which the error occurred.

5

The null value. However, if a trigger failed (error 1539), contains one of the following numeric values:1 – Insert trigger failed.2 – Update trigger failed.3 – Delete trigger failed.

6

The null value.

7

The null value.

When OLE errors numbered 1427 or 1429 occur, the array contains one row. The following table describes the contents of each element.

Element number Description

1

Numeric. Contains 1427 or 1429.

2

Character. The text of the Visual FoxPro error message.

3

Character. The text of the OLE error message.

4

Character. The application name (for example, Microsoft Excel).

5

The null value or Character. Contains the name of the application's Help file where more information about the error can be found if the information is available from the application; otherwise contains the null value.

6

The null value or Character. Contains the Help context ID for the appropriate Help topic if the information is available from the application; otherwise contains the null value.

7

Numeric. An OLE 2.0 exception number.

When an ODBC error numbered 1526 occurs, the array contains one or more rows, one row for each ODBC error. The following table describes the contents of each element.

Element number Description

1

Numeric. Contains 1526.

2

Character. The text of the error message.

3

Character. The text of the ODBC error message.

4

Character. The current ODBC SQL state.

5

Numeric. The error number from the ODBC data source.

6

Numeric. The ODBC connection handle.

7

The null value.

Example

The following example uses ON ERROR to specify an error handling routine named errhand. An error is generated by issuing a misspelled command (BRWS). The errhand error handling routine uses AERROR(В ) to create an array containing error information, and this information is then displayed.

В Copy Code
ON ERROR DO errhand     && errhand is the error handler procedure

BRWS  && Causes a syntax error
ON ERROR  && Restore system error handler

PROCEDURE errhand
   = AERROR(aErrorArray)  && Data from most recent error
   CLEAR
   ? 'The error provided the following information'  && Display message
   FOR n = 1 TO 7  && Display all elements of the array
      ? aErrorArray(n)
   ENDFOR

See Also



JavaScript Editor js editor     Web development