View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.processor;
8   
9   import org.mule.api.MuleEvent;
10  import org.mule.api.MuleException;
11  import org.mule.config.ExceptionHelper;
12  import org.mule.message.DefaultExceptionPayload;
13  import org.mule.transport.NullPayload;
14  
15  public class ExceptionHandlingMessageProcessor extends AbstractInterceptingMessageProcessor
16  {
17      public MuleEvent process(MuleEvent event) throws MuleException
18      {
19          try
20          {
21              return processNext(event);
22          }
23          catch (Exception e)
24          {
25              e = (Exception) ExceptionHelper.sanitizeIfNeeded(e);
26              return event.getFlowConstruct().getExceptionListener().handleException(e, event);
27          }
28      }
29  }