校验器提取为单独的项目。

This commit is contained in:
2022-12-14 13:41:37 +08:00
parent 80530edf6b
commit 6f4503684f
10 changed files with 7 additions and 631 deletions

View File

@@ -36,6 +36,11 @@
<artifactId>plusone-commons</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>xyz.zhouxy.plusone</groupId>
<artifactId>plusone-validator</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>xyz.zhouxy.plusone</groupId>
<artifactId>plusone-exception-handler</artifactId>

View File

@@ -1,56 +0,0 @@
package xyz.zhouxy.plusone.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
/**
* 4040200 - 无效的用户输入
*
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
*/
@ResponseStatus(HttpStatus.BAD_REQUEST)
public class InvalidInputException extends PlusoneException {
@java.io.Serial
private static final long serialVersionUID = 7956661913360059670L;
public static final int ERROR_CODE = 4040200;
private InvalidInputException(int code, String msg) {
super(code, msg);
}
private InvalidInputException(int code, Throwable cause) {
super(code, cause);
}
private InvalidInputException(int code, String msg, Throwable cause) {
super(code, msg, cause);
}
public InvalidInputException(String msg) {
this(ERROR_CODE, msg);
}
public InvalidInputException(Throwable cause) {
this(ERROR_CODE, cause);
}
public InvalidInputException(String msg, Throwable cause) {
this(ERROR_CODE, msg, cause);
}
/**
* 不支持的 Principal 类型出现时抛出的异常
*/
public static InvalidInputException unsupportedPrincipalTypeException() {
return unsupportedPrincipalTypeException("不支持的 PrincipalType");
}
/**
* 不支持的 Principal 类型出现时抛出的异常
*/
public static InvalidInputException unsupportedPrincipalTypeException(String message) {
return new InvalidInputException(4040201, message);
}
}