La interfaz de VDS Renaissance está disponible en varios idiomas. La documentación oficial se mantiene en inglés para garantizar una referencia única, coherente y siempre actualizada.

Error trapping

Run-time error messages may not be much of a problem in scripts you write for your own use, but they can be baffling if encountered by somebody else. To solve that problem, DialogScript allows you to trap run-time errors and write your own code for processing them.

To create an error trap you include the command:

                OPTION ERRORTRAP, <label>

somewhere near the start of the script. The effect of this command is that, if a run-time error occurs, execution will jump immediately to the line containing the label <label>. Obviously, it is a good idea to make sure the label exists, otherwise you will just get another run-time error.

Once in the error trap code, it is up to you how you process the error. It would be a good idea to turn the error trap off in case an error in the error trap causes the script to loop. You could then use WARN to display a friendly message to the user telling them what has happened and what to do. To terminate the script use the STOP command, since if the error occurred during execution of a GOSUB, the EXIT command will cause execution to carry on at the line after the GOSUB.

The @ERROR function lets you determine the error code, the number of the line that caused it, and the actual line of script that caused the error. You could display this information, or write it to an error log using a string list.

More advanced users could use error traps to improve the robustness of scripts that could be affected by user input or differences in the systems on which they are run. For example, if a user enters a value which causes a run-time error and it is difficult to validate the value in code, you could set an error trap, check for the error code and the line number it occurred at, and if they match this particular case, display a warning message and ask the user to enter the value again.