ErrorCodeException.java
1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.wondertek.exception;
/**
* 含错误码的异常类
*
* @author:
* @modify author:修改人 Modify on 修改时间
*/
public class ErrorCodeException extends RuntimeException {
private static final long serialVersionUID = -6862869612441955620L;
/** 错误码 */
private String errorCode;
/** 异常结果返回 */
private Object result;
public ErrorCodeException(String errorCode) {
this(errorCode, null, null);
}
public ErrorCodeException(String errorCode, String message) {
this(errorCode, message, null);
}
public ErrorCodeException(String errorCode, Throwable cause) {
this(errorCode, null, cause);
}
public ErrorCodeException(String errorCode, String message, Throwable cause) {
super(message, cause);
this.errorCode = errorCode;
}
public ErrorCodeException(String errorCode, String message, Object result) {
super(message);
this.errorCode = errorCode;
this.result = result;
}
public String getErrorCode() {
return errorCode;
}
@Override
public String getMessage() {
return super.getMessage();
}
public Object getResult() {
return this.result;
}
}