C.109 ThrowTask

Extension of build in FailTask that can throw an exception that is given by a reference. This may be useful if you want to rethrow the exception that has been caught by a TryCatchTask in the <catch> block.

Table C.132: Attributes

refidStringId of the referenced exception.n/aNo


In addition, all attributes of the FailTask are supported.

C.109.1 Example

<target name="tryCatchThrow">
  <trycatch property="foo" reference="bar">

      <echo>In <catch>.</echo>

      <echo>In <finally>.</echo>

  <echo>As property: ${foo}</echo>
  <property name="baz" refid="bar" />
  <echo>From reference: ${baz}</echo>

  <echo>Throw ...</echo>
  <throw refid="bar" />