60 lines
1.2 KiB
Java
60 lines
1.2 KiB
Java
|
|
package com.dpkj.common.exception;
|
|||
|
|
|
|||
|
|
|
|||
|
|
import lombok.Data;
|
|||
|
|
import lombok.EqualsAndHashCode;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 总的异常,所有的自定义异常都需要继承类
|
|||
|
|
*
|
|||
|
|
* @author <a href="https://gitee.com/shi-chongli">石头人</a>
|
|||
|
|
* @since 2023-07-24 09:42:00
|
|||
|
|
*/
|
|||
|
|
@EqualsAndHashCode(callSuper = true)
|
|||
|
|
@Data
|
|||
|
|
public class RRException extends RuntimeException{
|
|||
|
|
|
|||
|
|
private static final long serialVersionUID = 1L;
|
|||
|
|
|
|||
|
|
private String msg;
|
|||
|
|
private int code = 500;
|
|||
|
|
|
|||
|
|
public RRException(){
|
|||
|
|
super("系统错误");
|
|||
|
|
this.msg = "系统错误";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public RRException(Throwable throwable){
|
|||
|
|
super(throwable);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public RRException(String msg) {
|
|||
|
|
super(msg);
|
|||
|
|
this.msg = msg;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public RRException(String msg, Throwable e) {
|
|||
|
|
super(msg, e);
|
|||
|
|
this.msg = msg;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public RRException(int code, String msg) {
|
|||
|
|
super(msg);
|
|||
|
|
this.msg = msg;
|
|||
|
|
this.code = code;
|
|||
|
|
}
|
|||
|
|
public RRException(ErrorInterface error){
|
|||
|
|
super(error.getMessage());
|
|||
|
|
this.code = error.getCode();
|
|||
|
|
this.msg = error.getMessage();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public RRException(int code,String msg, Throwable e) {
|
|||
|
|
super(msg, e);
|
|||
|
|
this.msg = msg;
|
|||
|
|
this.code = code;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|