提交 feb0bdc5 作者: 方治民

chore: 优化全局异常方法名

上级 46b3828b
...@@ -49,7 +49,7 @@ public class GlobalExceptionHandler { ...@@ -49,7 +49,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler( @ExceptionHandler(
{ BindException.class, MethodArgumentNotValidException.class, ConstraintViolationException.class } { BindException.class, MethodArgumentNotValidException.class, ConstraintViolationException.class }
) )
public Result<String> bindErrorHandler(Exception e) { public Result<String> validFailHandler(Exception e) {
String details = null; String details = null;
if (e instanceof ConstraintViolationException) { if (e instanceof ConstraintViolationException) {
...@@ -102,7 +102,7 @@ public class GlobalExceptionHandler { ...@@ -102,7 +102,7 @@ public class GlobalExceptionHandler {
* @return 异常信息反馈 {@link Status#UNAUTHORIZED * @return 异常信息反馈 {@link Status#UNAUTHORIZED
*/ */
@ExceptionHandler(NotLoginException.class) @ExceptionHandler(NotLoginException.class)
public Result<String> notLoginErrorHandler() { public Result<String> unauthorizedErrorHandler() {
return Result.no(Status.UNAUTHORIZED); return Result.no(Status.UNAUTHORIZED);
} }
...@@ -126,7 +126,7 @@ public class GlobalExceptionHandler { ...@@ -126,7 +126,7 @@ public class GlobalExceptionHandler {
ApiDisabledException.class, ApiDisabledException.class,
} }
) )
public Result<String> notSafeErrorHandler() { public Result<String> forbiddenHandler() {
return Result.no(Status.FORBIDDEN); return Result.no(Status.FORBIDDEN);
} }
...@@ -150,7 +150,7 @@ public class GlobalExceptionHandler { ...@@ -150,7 +150,7 @@ public class GlobalExceptionHandler {
* 取消请求异常(忽略) * 取消请求异常(忽略)
*/ */
@ExceptionHandler({ ClientAbortException.class, AbortException.class, HttpMessageNotWritableException.class }) @ExceptionHandler({ ClientAbortException.class, AbortException.class, HttpMessageNotWritableException.class })
public void clientAbortExceptionHandler() {} public void ignoreExceptionHandler() {}
/** /**
* 其他异常 * 其他异常
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论