You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.2 KiB
60 lines
1.2 KiB
package com.ruoyi.common.exception;
|
|
|
|
import com.ruoyi.common.im.enums.ResultCode;
|
|
import lombok.Data;
|
|
|
|
import java.io.Serializable;
|
|
|
|
/**
|
|
* 全局异常
|
|
*
|
|
* @author ruoyi
|
|
*/
|
|
@Data
|
|
public class GlobalException extends RuntimeException implements Serializable
|
|
{
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private Integer code;
|
|
/**
|
|
* 错误提示
|
|
*/
|
|
private String message;
|
|
|
|
/**
|
|
* 错误明细,内部调试错误
|
|
*
|
|
* 和 {@link CommonResult#getDetailMessage()} 一致的设计
|
|
*/
|
|
private String detailMessage;
|
|
|
|
/**
|
|
* 空构造方法,避免反序列化问题
|
|
*/
|
|
public GlobalException()
|
|
{
|
|
}
|
|
|
|
public GlobalException(String message)
|
|
{
|
|
this.message = message;
|
|
}
|
|
|
|
|
|
public GlobalException(Integer code, String message) {
|
|
this.code = code;
|
|
this.message = message;
|
|
}
|
|
|
|
public GlobalException(ResultCode resultCode, String message) {
|
|
this.code = resultCode.getCode();
|
|
this.message = message;
|
|
}
|
|
|
|
public GlobalException(ResultCode resultCode) {
|
|
this.code = resultCode.getCode();
|
|
this.message = resultCode.getMsg();
|
|
}
|
|
|
|
|
|
} |