1
2
3
4
5
6
7 package org.mule.message;
8
9 import org.mule.api.MuleException;
10 import org.mule.api.ExceptionPayload;
11 import org.mule.config.ExceptionHelper;
12
13 import java.util.Map;
14
15
16
17
18
19 public class DefaultExceptionPayload implements ExceptionPayload
20 {
21
22
23
24 private static final long serialVersionUID = -7114836033686599024L;
25
26 private int code = 0;
27 private String message = null;
28 private Map info = null;
29 private Throwable exception;
30
31 public DefaultExceptionPayload(Throwable exception)
32 {
33 this.exception = exception;
34 MuleException muleRoot = ExceptionHelper.getRootMuleException(exception);
35 if (muleRoot != null)
36 {
37 message = muleRoot.getMessage();
38 code = muleRoot.getExceptionCode();
39 info = muleRoot.getInfo();
40 }
41 else
42 {
43 message = exception.getMessage();
44 }
45 }
46
47 public Throwable getRootException()
48 {
49 return ExceptionHelper.getRootException(exception);
50 }
51
52 public int getCode()
53 {
54 return code;
55 }
56
57 public String getMessage()
58 {
59 return message;
60 }
61
62 public Map getInfo()
63 {
64 return info;
65 }
66
67 public Throwable getException()
68 {
69 return exception;
70 }
71
72 }