ApiErrorMessage.java
925 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
package com.glsx.exception;
/**
* @Description: 异常枚举类
* @author fengzhi
* @version V1.0
*/
public enum ApiErrorMessage {
TOKEN_ERROR(1001,"token有误: [%s]"),
ARGS_ERROR(1002,"参数错误: [%s]"),
ILLEGAL_DEVICE_SN(1003,"devicesn不存在"),
AUTH_ERROR(1004,"未授权(Ip与设定的IP不符)"),
ILLEGAL_DEVICE_TYPE(1005,"devicetype不存在"),
PARAM_ERROR(1006,"各项数据格式、长度不正确"),
TOKEN_TIME_OUT(1007,"超时"),
ARGS_NULL(1008,"参数错误,必传参数");
private int code;
private String message;
public ApiException exception(Object ...args){
return new ApiException(this,args);
}
private ApiErrorMessage(int code, String message){
this.code = code;
this.message = message;
}
public int getCode() {
return code;
}
public String getMessage() {
return message;
}
}