ApiErrorMessage.java 921 Bytes
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,"参数错误,必传参数: %s");



    private int code;
    private String message;

    public ApiException exception(Object ...args){
        return new ApiException(this,args);
    }

    ApiErrorMessage(int code, String message){
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}