BaseException.java
890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.xly.exception.dto;
import com.xly.constant.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;
/***
* @Author 钱豹
* @Date 23:13 2026/1/30
* @Param
* @return
* @Description 基础异常定义
**/
@Data
@EqualsAndHashCode(callSuper = true)
public class BaseException extends RuntimeException {
private final Integer code;
private final String message;
public BaseException(ErrorCode errorCode) {
super(errorCode.getMessage());
this.code = errorCode.getCode();
this.message = errorCode.getMessage();
}
public BaseException(ErrorCode errorCode, String message) {
super(message);
this.code = errorCode.getCode();
this.message = message;
}
public BaseException(Integer code, String message) {
super(message);
this.code = code;
this.message = message;
}
}