<doc>
  <legacy_id>1793</legacy_id>
  <name>catch</name>
  <type>keyword</type>
  <syntax>
    <example>catch <i>errorParameter</i></example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Writing LiveCode</category>
  </classification>
  <references>
    <control_st tag="throw">throw Control Structure</control_st>
    <function tag="result">result Function</function>
  </references>
  <history>
    <introduced version="1.0">Added.</introduced>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
    <ios/>
    <android/>
  </platforms>
  <classes>
    <desktop/>
    <server/>
    <web/>
    <mobile/>
  </classes>
  <security>
  </security>
  <summary>Used within a <control_st tag="try">try</control_st> <glossary tag="control structure">control structure</glossary> to <glossary tag="handle">handle</glossary> <glossary tag="error">errors</glossary>.</summary>
  <examples>
    <example>catch myError</example>
  </examples>
  <description>
    <p>Use the <b>catch</b> <glossary tag="keyword">keyword</glossary> to <glossary tag="handle">handle</glossary> <glossary tag="error">errors</glossary> <glossary tag="return">returned</glossary> by a <glossary tag="handler">handler</glossary> with the <control_st tag="throw">throw</control_st> <glossary tag="control structure">control structure</glossary>.</p><p/><p><b>Comments:</b></p><p>When one of the statements in a <b>try</b> <glossary tag="control structure">control structure</glossary> causes an <glossary tag="execution error">execution error</glossary>, the <i>errorParamete</i>r is set to the error string, and the <glossary tag="statement">statements</glossary> after the <b>catch</b> <glossary tag="keyword">keyword</glossary> are <glossary tag="execute">executed</glossary>. If LiveCode generates the error (for example, an <glossary tag="execution error">execution error</glossary> from a built-in <glossary tag="command">command</glossary>), the <i>errorParameter</i> is a positive number. An error string can also be returned from a <glossary tag="handler">handler</glossary> by the <control_st tag="throw">throw</control_st> <glossary tag="keyword">keyword</glossary>.</p><p/><p>The statements after the <b>catch</b> <glossary tag="keyword">keyword</glossary> are only <glossary tag="execute">executed</glossary> if there is an <glossary tag="error">error</glossary>. These <glossary tag="statement">statements</glossary> can refer to the <function tag="value">value</function> of the <i>errorParameter</i>. For example, the <b>catch</b> section might contain an <control_st tag="if">if</control_st> or <control_st tag="switch">switch</control_st> <glossary tag="control structure">control structure</glossary>, which does different things depending on the value of the <i>errorParameter</i>.</p>
  </description>
</doc>