Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

ERROR$ generated a dialog to present an error with a possibility to terminate the process hereafter

Syntax

ERROR$(Document$, Error$, Caption$, Mode)

...

  1. The INCASE function is a convenient function to use in combination with the ERROR$ function. The INCASE can be used to define Error$, either to be "NullString" or have a message depending on another value or parameter.
  2. Mode's 2 or 4 will be the most useful options because these buttons most clearly provide a indication of what will happen.

Examples

Example 1

The ERROR$ function can be used to gracefully terminate a modeling session if a specific error is generated by a satellite program.

...

If the result of ProgX_calculation#.ProgX_Errors$ is different from "No errors...", a message box is shown with the error string and with the caption "Error running ProgX". Depending on the type of buttons specified in the dialog by means of the Mode parameter, the session can be either immediately be terminated, or you can decide to let Quaestor attempt to continue the session.

The syntax is as follows.

ProgX_Errors$ = ERROR$(ProgX_calculation#.ProgX_Errors$,INCASE(ProgX_calculation#.ProgX_Errors$ = "No errors...", THEN, "NullString", ELSE, ProgX_calculation#.ProgX_Errors$), "Error running ProgX", 4) + Qcrlf

...

Please note that you can combine an understandable message with the error and the selected dialog buttons, such as the example below:

DESP_error_flag$ = ERROR$(INCASE(GET$("Desp.err","NullString", Total_Desp$)="NullString", THEN,
                                                   "No errors occurred...", ELSE,
                                                    DESP_Errors$)
                                       ,INCASE(GET$("Desp.err","NullString", Total_Desp$)="NullString", THEN,
                                                    "NullString", ELSE,
                                                     GET$("Desp.err","NullString", Total_Desp$)+Qcrlf+Qcrlf+
                                                     "Please check your input. Do you want to continue?")
                                       ,"In the DESP calculation a fatal error has occurred (details shown below).",4)

...