feat: 新增一个登录状态异常类

This commit is contained in:
weihongyang 2022-06-22 09:56:52 +08:00
parent 2bf099ee6d
commit e130377e8c

Vedi File

@ -0,0 +1,66 @@
package com.cnbm.admin.exception;
import com.cnbm.common.exception.ErrorCode;
import com.cnbm.common.utils.MessageUtils;
/**
* @Author weihongyang
* @Date 2022/6/22 9:44 AM
* @Version 1.0
*/
public class LoginStatusException extends RuntimeException{
private static final long serialVersionUID = 1L;
private int code;
private String msg;
public LoginStatusException(int code) {
this.code = code;
this.msg = MessageUtils.getMessage(code);
}
public LoginStatusException(int code, String... params) {
this.code = code;
this.msg = MessageUtils.getMessage(code, params);
}
public LoginStatusException(int code, Throwable e) {
super(e);
this.code = code;
this.msg = MessageUtils.getMessage(code);
}
public LoginStatusException(int code, Throwable e, String... params) {
super(e);
this.code = code;
this.msg = MessageUtils.getMessage(code, params);
}
public LoginStatusException(String msg) {
super(msg);
this.code = ErrorCode.INTERNAL_SERVER_ERROR;
this.msg = msg;
}
public LoginStatusException(String msg, Throwable e) {
super(msg, e);
this.code = ErrorCode.INTERNAL_SERVER_ERROR;
this.msg = msg;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
}