1
2
3
4
5
6
7 package org.mule.transport.jms;
8
9 import org.mule.api.config.ExceptionReader;
10
11 import java.util.HashMap;
12 import java.util.Map;
13
14 import javax.jms.JMSException;
15
16
17
18
19
20 public class JmsExceptionReader implements ExceptionReader
21 {
22
23 public String getMessage(Throwable t)
24 {
25 JMSException e = (JMSException)t;
26 return e.getMessage() + "(JMS Code: " + e.getErrorCode() + ")";
27 }
28
29 public Throwable getCause(Throwable t)
30 {
31 JMSException e = (JMSException)t;
32 Throwable cause = e.getLinkedException();
33 if (cause == null)
34 {
35 cause = e.getCause();
36 }
37 return cause;
38 }
39
40 public Class<?> getExceptionType()
41 {
42 return JMSException.class;
43 }
44
45
46
47
48
49
50 public Map<?, ?> getInfo(Throwable t)
51 {
52 JMSException e = (JMSException)t;
53 Map<String, Object> info = new HashMap<String, Object>();
54 info.put("JMS Code", e.getErrorCode());
55 return info;
56 }
57
58 }