This commit is contained in:
2023-02-19 04:21:39 +08:00
parent 92dbc613d2
commit 9293ba6817
16 changed files with 122 additions and 28 deletions

View File

@@ -39,12 +39,12 @@
<dependency>
<groupId>xyz.zhouxy.plusone</groupId>
<artifactId>plusone-commons</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>xyz.zhouxy.plusone</groupId>
<artifactId>plusone-validator</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>xyz.zhouxy.plusone</groupId>

View File

@@ -0,0 +1,37 @@
package xyz.zhouxy.plusone.exception;
/**
* 业务异常
*
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
*/
public class BizException extends BaseException {
@java.io.Serial
private static final long serialVersionUID = -5524759033245815405L;
public static final int DEFAULT_ERROR_CODE = 4000000;
public BizException(int code, String msg) {
super(code, msg);
}
public BizException(int code, Throwable cause) {
super(code, cause);
}
public BizException(int code, String msg, Throwable cause) {
super(code, msg, cause);
}
public BizException(String msg) {
super(DEFAULT_ERROR_CODE, msg);
}
public BizException(Throwable cause) {
super(DEFAULT_ERROR_CODE, cause);
}
public BizException(String msg, Throwable cause) {
super(DEFAULT_ERROR_CODE, msg, cause);
}
}

View File

@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.ResponseStatus;
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
*/
@ResponseStatus(HttpStatus.NOT_FOUND)
public class DataNotExistException extends PlusoneException {
public class DataNotExistException extends BizException {
@java.io.Serial
private static final long serialVersionUID = 6536955800679703111L;

View File

@@ -8,13 +8,12 @@ import org.springframework.web.bind.annotation.ResponseStatus;
*
* <p>
* 暂时先这样,后续完善异常体系时可能会更改。
* </p>
*
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
* @see xyz.zhouxy.plusone.util.AssertResult
*/
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public class DataOperationResultException extends PlusoneException {
public class DataOperationResultException extends SysException {
@java.io.Serial
private static final long serialVersionUID = -9220765735990318186L;

View File

@@ -0,0 +1,32 @@
package xyz.zhouxy.plusone.exception;
public class SysException extends BaseException {
@java.io.Serial
private static final long serialVersionUID = 8821240827443168118L;
public static final int DEFAULT_ERROR_CODE = 5000000;
public SysException(int code, String msg) {
super(code, msg);
}
public SysException(int code, Throwable cause) {
super(code, cause);
}
public SysException(int code, String msg, Throwable cause) {
super(code, msg, cause);
}
public SysException(String msg) {
super(DEFAULT_ERROR_CODE, msg);
}
public SysException(Throwable cause) {
super(DEFAULT_ERROR_CODE, cause);
}
public SysException(String msg, Throwable cause) {
super(DEFAULT_ERROR_CODE, msg, cause);
}
}

View File

@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.ResponseStatus;
* @author ZhouXY
*/
@ResponseStatus(HttpStatus.BAD_REQUEST)
public class UserOperationException extends PlusoneException {
public class UserOperationException extends BizException {
@java.io.Serial
private static final long serialVersionUID = 4371055414421991940L;