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 | 0 | super(); |
31 | 0 | } |
32 | |
|
33 | |
public DefaultSystemExceptionStrategy(MuleContext muleContext) |
34 | |
{ |
35 | 0 | super(); |
36 | 0 | setMuleContext(muleContext); |
37 | 0 | } |
38 | |
|
39 | |
public void handleException(Exception e) |
40 | |
{ |
41 | 0 | if (enableNotifications) |
42 | |
{ |
43 | 0 | fireNotification(new ExceptionNotification(e)); |
44 | |
} |
45 | |
|
46 | 0 | logException(e); |
47 | |
|
48 | 0 | handleTransaction(e); |
49 | |
|
50 | 0 | if (RequestContext.getEvent() != null) |
51 | |
{ |
52 | 0 | RequestContext.setExceptionPayload(new DefaultExceptionPayload(e)); |
53 | |
} |
54 | 0 | } |
55 | |
} |