title: In Apigee, how do I catch faults connecting to the target server?
body: <p>Suppose I have this target defined: </p>
  
  <pre><code>&lt;TargetEndpoint name="default"&gt;
      &lt;PreFlow name="PreFlow"&gt;
          &lt;Request/&gt;
          &lt;Response/&gt;
      &lt;/PreFlow&gt;
      &lt;HTTPTargetConnection&gt;
          &lt;URL&gt;http://host1.example.com:39282&lt;/URL&gt;
      &lt;/HTTPTargetConnection&gt;
      &lt;PostFlow name="PostFlow"&gt;
          &lt;Request/&gt;
          &lt;Response/&gt;
      &lt;/PostFlow&gt;
      &lt;FaultRules&gt;
           ....
      &lt;/FaultRules&gt;
  &lt;/TargetEndpoint&gt;
  </code></pre>
  
  <p>How do I catch target errors like "Connection refused", which would occur when the target is not listening on the given port, or "Host not reachable", which would occur if there is no route to the given host or if the DNS name is not resolvable? </p>
  
  <p>Basically I want the recipe for how to specify the <code>FaultRule</code> that would be placed inside the <code>FaultRules</code> element above. </p>
  
  <pre><code>&lt;FaultRules&gt;
      &lt;FaultRule name="catch1"&gt;
          &lt;Condition&gt;WHAT GOES HERE???&lt;/Condition&gt;  &lt;!--- ??? ---&gt;
          &lt;Step&gt;
              &lt;Name&gt;AssignMessage-1&lt;/Name&gt;
          &lt;/Step&gt;
      &lt;/FaultRule&gt;
      &lt;FaultRule name="catch2"&gt;
          &lt;Step&gt;
              &lt;Name&gt;AssignMessage-2&lt;/Name&gt;
          &lt;/Step&gt;
      &lt;/FaultRule&gt;
  &lt;/FaultRules&gt;
  </code></pre>