catch | |||||||
Type | keyword | ||||||
Dictionary | LCS | ||||||
Library | LiveCode Script | ||||||
Syntax |
| ||||||
Summary | Used within a try control structure to handle errors. | ||||||
Introduced | 1.0 | ||||||
OS | mac, windows, linux, ios, android | ||||||
Platforms | desktop, server, mobile | ||||||
Parameters |
| ||||||
Example |
| ||||||
Related | Control Structure: if, switch, try, throw Glossary: return, handle, handler, execute, error, statement, execution error, keyword, control structure, command Function: result, value | ||||||
Description | Use the catch keyword to handle errors returned by a handler with the throw control structure. When one of the statements in a try control structure causes an execution error, the errorParameter is set to the error string, and the statements after the catch keyword are executed. If LiveCode generates the error (for example, an execution error from a built-in command), the errorParameter is a positive number. An error string can also be returned from a handler by the throw keyword. The statements after the catch keyword are only executed if there is an error. These statements can refer to the value of the errorParameter. For example, the catch section might contain an if or switch control structure, which does different things depending on the value of the errorParameter. |