Displaying an error message

error

Display an error message


SYNTAX

error text_expression [, text_expression]…

Opens a window and displays the specified text within it. Awaits user confirmation, then closes the window and continues processing with the next statement.

text_expression

The text_expression may be a string constant, an alphanumeric field, or a concatenation of several such items using the operators / and +. A numeric field may not be used directly in an error message. Either assign it to an alphanumeric field, or use the tostr() function, which converts an expression to text.

To display more than one line of text, separate the text_expressions by commas. Each will appear on a separate line. Use the backslash character to create continuation lines if necessary:

error "error text line 1", \
    "error text line 2", \
    "error text line 3"

Note that with multiple lines, the error command does not work correctly if the first line is an alpha variable, rather than a quoted string. Fixing this bug would have produced code that was not backwardly compatible, so the recommended method of working around it is to use the tostr() function, e.g.:

error tostr(tmp.LineOne), tmp.LineTwo

Automatic error generation

The following trappable conditions generate an automatic error unless trapped:

Error

Meaning

err

Sequential file error

fe

File exists

nsf

No such file

nsr

No such record

nrs

No record selected

re

Record exists


Note

A bell may be rung to accompany the display of an error message. This is determined by Section # 2 (INFO) Sequence 5 (Ring bell with error message (Y/N)) in the terminal parameter file.

EXAMPLE

error "Unable to insert record - reference incomplete"
error "Sculptor error " + tostr(sys.Error), "Terminating program"

error "Unable to find record",\
     "Invalid search code entered", \
     "Format is NNNN.NN"

image0


RELATED TOPICS

caption

info

Traps