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
55
56
57
58
package com.yanzuoguang.util.exception;
/**
* 途比达异常信息
*
* @author 颜佐光
*/
public class HttpCodeException extends RuntimeException {
private static final long serialVersionUID = -4625832188480820883L;
/**
* 错误码
*/
private String code = "99";
/**
* 包含的数据
*/
private Object target = null;
/**
* 获取错误码
*
* @return 返回的结果
*/
public String getCode() {
return this.code;
}
/**
* 来源数据
*
* @return
*/
public Object getTarget() {
return target;
}
/**
* 构造函数
* throw new CodeException("01","该订单已过期",order);
* throw new CodeException("02","该订单未到使用时间",order);
*
* @param code 错误码
* @param message 错误消息
* @param target 错误数据源,如订单数据
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
*/
public HttpCodeException(String code, String message, Object target, Throwable cause) {
super(message, cause);
this.code = code;
this.target = target;
}
}