GatewayException.java
836 Bytes
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
package com.yoho.rfid.util;
import com.yoho.error.GatewayError;
/**
*
* API Gateway异常父类
*
* Created by chang@yoho.cn on 2015/11/3.
*/
public class GatewayException extends Exception{
private int code;
private String desc;
/**
*
* 异常
* @param gatewayError gateway错误码
*/
public GatewayException(GatewayError gatewayError){
this.code = gatewayError.getCode();
this.desc = gatewayError.getMessage();
}
/**
*/
public GatewayException(int code, String desc){
this.code = code;
this.desc=desc;
}
@Override
public String getMessage() {
return "[" + this.code + ":" + this.desc + "]";
}
public String getDesc() {
return desc;
}
public int getErrorCode() {
return code;
}
}