Name: catch

Type: keyword

Syntax: catch <errorParameter>

Summary:
Used within a <try> <control structure> to <handle> <error|errors>.

Introduced: 1.0

OS: mac, windows, linux, ios, android

Platforms: desktop, server, mobile

Example:
catch myError

Parameters:
errorParameter:


Description:
Use the <catch> <keyword> to <handle> <error|errors> <return|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 <statement|statements> after the <catch> <keyword> are
<execute|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 <execute|executed>
if there is an <error>. These <statement|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>.

References: if (control structure), switch (control structure),
try (control structure), throw (control structure), result (function),
value (function), return (glossary), handle (glossary),
handler (glossary), execute (glossary), error (glossary),
statement (glossary), execution error (glossary), keyword (glossary),
control structure (glossary), command (glossary)

