18.3. Debugging Scripts and Extensions

epcEdit handles errors in Tcl scripts by trapping the error and displaying a simplified error message if appropriate. This behaviour is achieved by substituting the Tcl error handler with a epcEdit-defined error handler.

Consider the following example: When you try to insert data in a where data is not allowed, epcEdit refuses to insert the data and display the message "Data is not allowed here" in the status bar. The attempt to insert data at an invalid location raises an error that is trapped by epcEdit's error handler. Certain errors are caught by the error handler and lead to a special reaction while an error dialog is displayed for some other errors.

You can prevent epcEdit from substituting the Tcl error handler by setting the environment variable EPCEDIT_DEVELOPMENT to 1 before starting epcEdit. If this environment variable is set, the normal Tcl error handler will be used to report errors that occur. For example, the attempt to insert data at an invalid location will result in the following error dialog if the normal Tcl error handler is in use:

The Tcl error dialogs provides you with additional information about the command that caused the error and contains a backtrace of the execution stack.

Warning

Disabling epcEdit's error handler by setting the EPCEDIT_DEVELOPMENT environment variable disables important functionality in epcEdit. This variable should only be set as long as debugging support is required.