refactor(core): 完善自定义异常类构造方法

This commit is contained in:
2024-02-19 20:24:03 +08:00
parent c9867844b6
commit d42585cb4d
3 changed files with 39 additions and 0 deletions

View File

@@ -16,6 +16,8 @@
package top.charles7c.continew.starter.core.exception;
import java.io.Serial;
/**
* 自定义验证异常-错误请求
*
@@ -24,10 +26,21 @@ package top.charles7c.continew.starter.core.exception;
*/
public class BadRequestException extends BaseException {
@Serial
private static final long serialVersionUID = 1L;
public BadRequestException() {
}
public BadRequestException(String message) {
super(message);
}
public BadRequestException(Throwable cause) {
super(cause);
}
public BadRequestException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@@ -16,6 +16,8 @@
package top.charles7c.continew.starter.core.exception;
import java.io.Serial;
/**
* 自定义异常基类
*
@@ -24,10 +26,21 @@ package top.charles7c.continew.starter.core.exception;
*/
public class BaseException extends RuntimeException {
@Serial
private static final long serialVersionUID = 1L;
public BaseException() {
}
public BaseException(String message) {
super(message);
}
public BaseException(Throwable cause) {
super(cause);
}
public BaseException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@@ -16,6 +16,8 @@
package top.charles7c.continew.starter.core.exception;
import java.io.Serial;
/**
* 业务异常
*
@@ -24,10 +26,21 @@ package top.charles7c.continew.starter.core.exception;
*/
public class BusinessException extends BaseException {
@Serial
private static final long serialVersionUID = 1L;
public BusinessException() {
}
public BusinessException(String message) {
super(message);
}
public BusinessException(Throwable cause) {
super(cause);
}
public BusinessException(String message, Throwable cause) {
super(message, cause);
}
}