1
2
3
4
5
6
7
8
9
10
11 package org.mule.exception;
12
13 import org.mule.RequestContext;
14 import org.mule.api.MuleContext;
15 import org.mule.api.exception.SystemExceptionHandler;
16 import org.mule.context.notification.ExceptionNotification;
17 import org.mule.message.DefaultExceptionPayload;
18
19
20
21
22 public class DefaultSystemExceptionStrategy extends AbstractExceptionListener implements SystemExceptionHandler
23 {
24
25
26
27
28 public DefaultSystemExceptionStrategy()
29 {
30 super();
31 }
32
33 public DefaultSystemExceptionStrategy(MuleContext muleContext)
34 {
35 super();
36 setMuleContext(muleContext);
37 }
38
39 public void handleException(Exception e)
40 {
41 if (enableNotifications)
42 {
43 fireNotification(new ExceptionNotification(e));
44 }
45
46 logException(e);
47
48 handleTransaction(e);
49
50 if (RequestContext.getEvent() != null)
51 {
52 RequestContext.setExceptionPayload(new DefaultExceptionPayload(e));
53 }
54 }
55 }