提交 4b2b0d98 作者: 方治民

feat: 更新 gradle 版本、新增 sourceCompatibility=17、调整全局异常配置

上级 f308578a
......@@ -42,4 +42,6 @@ dependencies {
// fastjson
implementation "com.alibaba:fastjson:${fastJsonVersion}"
// hutool-core
implementation "cn.hutool:hutool-core:${hutoolVersion}"
}
......@@ -42,8 +42,8 @@ public class GlobalExceptionHandler {
public Result<String> bindErrorHandler(Exception e) {
String error = "未知参数校验错误";
if (e instanceof ConstraintViolationException ex) {
error = ex.getConstraintViolations().iterator().next().getMessage();
if (e instanceof ConstraintViolationException) {
error = ((ConstraintViolationException) e).getConstraintViolations().iterator().next().getMessage();
} else {
BindingResult result = null;
if (e instanceof MethodArgumentNotValidException) {
......@@ -94,7 +94,7 @@ public class GlobalExceptionHandler {
* 失败状态异常
*/
@ExceptionHandler(value = FailStatusException.class)
public Result<String> customCodeExceptionHandler(FailStatusException e) {
public Result<String> failStatusExceptionHandler(FailStatusException e) {
return Result.no(e.getStatus());
}
......
......@@ -43,6 +43,8 @@ allprojects {
maven { url 'https://maven.aliyun.com/repository/public' }
mavenCentral()
}
sourceCompatibility = '17'
}
subprojects {
......
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论