
cn.easyutil.project.base.exception.Error Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of easyproject-base Show documentation
Show all versions of easyproject-base Show documentation
the project building with this core
The newest version!
package cn.easyutil.project.base.exception;
/**
* 异常code
*/
public enum Error implements ErrorEnum {
// =================== 系统异常 ============================
/**
* 未知异常
*/
notKnow_error(-1, "未知异常,未知异常,请与客服联系"),
/**
* 系统异常
*/
system_error(9999, "系统异常", "服务异常,请与客服联系"),
/**
* 空指针异常,服务器错误
*/
system_nullpoint_error(9998, "空指针异常,服务器错误"),
// =======================请求相关===================================
/**
* 缺少请求参数
*/
request_lost_param(101, "缺少请求参数", "缺少请求数据,请检查", "系统异常,请与客服联系"),
/**
* 解密token不存在, 请求未加密
*/
request_AES_notfind(102, "解密token不存在, 请求未加密", "请求超时,请重试"),
/**
* 解密处理异常, 加密数据不完整
*/
request_AES_error(103, "解密处理异常, 加密数据不完整", "请求超时,请重试"),
/**
* 未找到对应的请求号
*/
request_call_notfind(104, "找不到请求号", "未找到对应的请求号,服务异常,请与客服联系"),
/**
* 时间戳作为查询条件时,大于当前时间!
*/
request_createtime_fail(105, "时间戳作为查询条件时,大于当前时间!"),
/**
* 请求参数验证错误
*/
request_params_error(106, "请求参数验证错误"),
/**
* 请传入分页信息
*/
request_page_params(107, "请传入分页信息", "请传入分页信息"),
/**
* 请求加密接口,未建立加密token
*/
request_not_token(108, "请求加密接口,未建立加密token", "请求超时,请重试"),
// ========================文件服务=====================================
/**
* 没有选择上传文件
*/
file_upload_empty(201, "没有选择上传文件"),
/**
* 未找到对应的文件
*/
file_download_notfind(202, "未找到对应的文件"),
/**
* 文件类型错误
*/
file_pofix_error(203,"文件类型错误"),
/**
* 文件超出限制大小
*/
file_size_too_lang(204,"文件超出限制大小"),
//==================权限相关================================
/**
* 用户未登陆
*/
user_not_login(301,"用户未登陆"),
/** 用户身份类型未知 */
user_type_unknow(302, "用户身份类型未知", "无权操作"),
/** 该用户尚未注册*/
user_not_register(303, "该用户尚未注册", "该用户尚未注册"),
/** 该手机号已注册*/
use_mobile_had_register(304, "该手机号已注册", "该手机号已注册"),
/** 该用户不存在*/
user_not_found(305,"该用户不存在","该用户不存在"),
/** 用户名或密码错误*/
user_account_or_password_error(306,"用户名或密码错误"),
/** 该用户无权限*/
user_no_power(307, "该用户无权限", "该用户无权限"),
/** 用户未绑定微信*/
user_wechat_not_bind(310, "用户未绑定微信"),
/** 用户未绑定手机号*/
user_mobile_not_bind(311, "用户未绑定手机号"),
/** 微信登陆失败*/
user_wechat_openid_not_find(312,"微信登陆失败", "未找到openid"),
/** 该微信已绑定,请更换微信号*/
user_wechat_openid_exist(313,"该微信已绑定,请更换微信号","openid已存在"),
/** 已经绑定了微信,不能重复绑定*/
user_wechat_is_bind(314, "用户已经绑定了微信,不能重复绑定","已经绑定了微信,不能重复绑定"),
/** 请先发送验证码*/
user_sms_code_not_send(321, "请先发送验证码", "请先发送验证码"),
/** 短信验证码输入不正确*/
user_sms_code_error(322, "短信验证码输入不正确", "短信验证码输入不正确"),
/** 验证码发送次数太多,请稍后再试*/
user_sms_code_send_more(323, "验证码发送次数太多,请稍后再试", "验证码发送次数太多,请稍后再试"),
/** 验证码发送次数太多,今日已无法发送*/
user_sms_code_send_more_today(324, "验证码发送次数太多,今日已无法发送", "验证码发送次数太多,今日已无法发送"),
/** 尚未通过该手机号发送验证码 */
user_phone_not_send(325, "尚未通过该手机号发送验证码", "尚未通过该手机号发送验证码"),
/** 手机号码格式错误 */
user_phone_format_error(326, "手机号码格式错误", "手机号码格式错误"),
/** 微信授权失败 */
user_wechat_get_token_fail(327, "微信授权失败", "微信授权失败"),
error(-1, "未知异常,未知异常,请与客服联系");
/**
* 编码值
*/
private int code;
/**
* 备注,提示
*/
private String remark;
/**
* 异常显示问题
*/
private String[] viewMsg;
/**
* 异常枚举类
*
* @param code
* 编码值
* @param remark
* 备注,提示
*/
private Error(int code, String remark, String... viewMsg) {
this.code = code;
this.remark = remark;
this.viewMsg = viewMsg;
}
/**
* 依据异常编码值获取异常
*/
public static Error getErrorCode(int code) {
for (Error ec : Error.values()) {
if (ec.getCode() == code) {
return ec;
}
}
return notKnow_error;
}
public int getCode() {
return code;
}
public String getRemark() {
return remark;
}
public String getViewMsg() {
return viewMsg != null && viewMsg.length > 0 ? viewMsg[0] : remark;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy