How are errors handled during the execution of an SVB program?

Statistica Visual Basic provides the same facilities for error handling as other general implementations of Visual Basic. Thus, detailed discussions on error handling can be found in the numerous general sources describing this programming language.

General Visual Basic errors, math errors, etc
A standard method for trapping general Visual Basic errors, such as math errors (e.g., division by zero), is to use the On Error Goto ... statement, to direct the program flow to a particular label in the program. Note that each subroutine and function should have its own On Error Goto statement. Here is a simple example program that will generate a division-by-zero math error.

Sub Main ' Set the label where to go if an ' error occurs.

On Error GoTo DisplayVBError Dim x As Double, y As Double y=0

' Division-by-zero error

x=2/y Exit Sub

' An error occurred; Visual Basic maintains ' an object called Err with various properties; ' the Description property contains the description ' of the most recent error. DisplayVBError:

MsgBox Err.Description Exit Sub

End Sub

Visual Basic maintains and updates an object called Err. The property Err.Description contains the description of the most recent error. To clear the last error event, set Err to zero. It is generally good programming practice to write the subroutines and functions so that "clean" error exits can be accomplished, i.e., that code is provided that explicitly handles any errors.

Statistica analysis errors. Fatal errors (those that prevent the respective analysis from being completed) that occur as part of the analysis inside a Statistica module (e.g., incorrect selection of variables) are handled in the same way as during the interactive analysis, i.e., the program will display a message box explaining the error that has occurred, and how to remedy it.