title: Mule ESB: How to handle Exception in Mule Batch through MEL
body: <p>I'm using batch in mule for the first time, not sure how to handle the exceptions for batch records.</p>
  
  <p>Records getting failed input phase, but not able to catch failure exception either in input phase logger and also in Batch step( Failure flow)logger. Perhaps MEL <strong>#[inputPhaseException]</strong> itself throwing exception.</p>
  
  <pre><code>&lt;batch:job name="Batch1" max-failed-records="-1"&gt;
      &lt;batch:threading-profile poolExhaustedAction="WAIT"/&gt;
      &lt;batch:input&gt;
          &lt;file:inbound-endpoint path="C:\IN" responseTimeout="10000" doc:name="File"/&gt;
   &lt;component class="com.General" doc:name="Java"/&gt;
          &lt;logger message="InputPhase: #[inputPhaseException]" level="INFO" doc:name="Logger"/&gt;
      &lt;/batch:input&gt;
      &lt;batch:process-records&gt;
          &lt;batch:step name="Batch_Step"  accept-policy="ALL" "&gt;
              &lt;data-mapper:transform config-ref="Pojo_To_CSV" doc:name="Pojo To CSV"/&gt;               
              &lt;file:outbound-endpoint path="C:\Users\OUT" outputPattern="#[function:dateStamp]_product.csv" responseTimeout="10000" doc:name="File"/&gt;
          &lt;/batch:step&gt;
          &lt;batch:step name="FailureFlow" accept-policy="ONLY_FAILURES"&gt;
              &lt;logger message="Inside Failure: #[getStepExceptions()], Loading Phase: #[failureExceptionForStep],#[inputPhaseException] " level="ERROR" doc:name="Logger"/&gt;
          &lt;/batch:step&gt;
      &lt;/batch:process-records&gt;
      &lt;batch:on-complete&gt;
          &lt;logger level="INFO" doc:name="Logger" message=" On Complete: #[payload.loadedRecords] Loaded Records #[payload.failedRecords] Failed Records"/&gt;
      &lt;/batch:on-complete&gt;
  &lt;/batch:job&gt;
  </code></pre>
  
  <p>Is there is any restriction for batch MEL to be used only inputphase and certain MEL on Process Record and Complete. Because i tried keep most of the get..Exception{} in Failure flow, it is throwing error.
  Please suggest, Thanks in advance.</p>