Error getting tags :
error 404Error getting tags :
error 404 try | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Expander triangle
Control Structure
try statementList catch errorVariable errorStatementsList [finally cleanupStatementsList] end try
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
None required
Executes a list of statements, sending any errors to the trystructure to be handled.

Additional Comments
Expander triangle

Use the try control structure to execute a series of statements and handle any error messages in the catch section, instead of letting Revolution display the error window.


The try control structure begins with the word try on a single line, followed by a list of Revolution statements.

The catch section begins with the catch keyword, followed by a parameter name. If any errors occur during execution of the statementList, the error message is placed in the errorVariable parameter, and the errorStatementsList is executed. statements in the errorStatementsList can refer to the value of the errorReport.

The catch section may be followed by an optional finally section. The cleanupStatementsList is executed normally, even if Revolution encountered an exit or pass statement in the statementList.

The try structure ends with an end try statement.


The statementList, errorStatementsList, and cleanupStatementsList each consist of one or more valid Revolution statements.

The errorVariable is a valid variable name.


Each of the statements in the statementList is executed normally, just as though the statementList were not in a try structure, except that any errors that would normally display an error window instead trigger the catch section. This happens even if the error is in another handler that's called from within the try structure.

The statements in the catch section are executed only if an error occurs. Only errors that would normally display the error window are handled by the catch section. If the error would not normally display the error window--for example, errors when opening a file with the open file command--it doesn't trigger the catch section.

The statements in the finally section are executed whether or not there is an error. Since the finally section is always executed even if the statementList contains an exit or pass statement, it can be used for final cleanup actions such as deleting variables. The finally section is an optional part of the try structure.

Note: The trycontrol structure is implemented internally as a command and appears in the commandNames.

User Comments
Expander triangle